Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Storing and Using RDF in Mulgara : Page 3

The semantic web is about machine-processable metadata. As you accumulate this information, where do you plan on putting it, and how do you plan on accessing it? Check out this open source solution.


advertisement
Get Out the Triples
Now that you have some triples in your model, you'll need to know how to get them out. Mulgara supports an RDF query language called iTQL. Soon, it will support the W3C SPARQL query language as well. If you are comfortable with iTQL, you'll be comfortable with SPARQL when the support is added.

To find all the triples in the model, you can enter this command in the Query Text field and submit the query (if the Model URI text field specifies the correct model, you can simply select "Step 3. List everything in the model"):

select $subject $predicate $object from <rmi://localhost/server1#devx> where $subject $predicate $object;

Your result should be similar to the result shown in Figure 2.



The names that begin with "$" are variables that you are selecting from the model. While the names can be anything you like, the references in the select clause must match how they are used in the rest of the query in order for the relationships to mean anything. To constrain the query to a particular relationship:

alias <http://purl.org/dc/elements/1.1/> as dc; select $subject $object from <rmi://localhost/server1#devx> where $subject <dc:title> $object;

This example says that you want to know which subjects are related to which objects through the Dublin Core title predicate. You could also read this as, "Show me all the things that have titles as well as what those titles are" (see Figure 3).
 
Figure 2. Querying Triples in Your Model: This result reflects an unconstrained query of all of the triples that have been captured in your model. Figure 3. Querying for Specific Predicates: When querying RDF data, usually you want to ask specific questions about the data: What has this value? What things are connected by this relationship?
To query for elements with particular values, try something like this:

select $subject from <rmi://localhost/server1#devx> where $subject $predicate 'blue';

As you see, the selection variables drive the results that show up based on the pattern matches. There isn't time to go through a full iTQL tutorial here. However, if you are running Mulgara, you can access the iTQL documentation page here: http://localhost:8080/itqlcommands/index.html (don't forget to replace localhost with whatever name you bound your server against.)



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap