Skip to content

Instantly share code, notes, and snippets.

@jineshpaloor
Last active August 29, 2015 14:26
Show Gist options
  • Select an option

  • Save jineshpaloor/9c842a8674c885881d07 to your computer and use it in GitHub Desktop.

Select an option

Save jineshpaloor/9c842a8674c885881d07 to your computer and use it in GitHub Desktop.
./stardog query --reasoning foafDB "PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name
WHERE {
?person foaf:name ?name .
}
"
# example: A part from a owl / rdf
<rdf:Description rdf:about="http://dig.csail.mit.edu/2008/webdav/timbl/foaf.rdf#dj">
<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>
<s:seeAlso rdf:resource="http://www.grorg.org/dean/foaf.rdf"/>
<foaf:homepage rdf:resource="http://www.grorg.org/dean/"/>
<foaf:mbox rdf:resource="mailto:dean@w3.org"/>
<foaf:mbox rdf:resource="mailto:dino@grorg.org"/>
<foaf:mbox_sha1sum>6de4ff27ef927b9ba21ccc88257e41a2d7e7d293</foaf:mbox_sha1sum>
<foaf:name>Dean Jackson</foaf:name>
</rdf:Description>
Here the "<rdf:type rdf:resource="http://xmlns.com/foaf/0.1/Person"/>" says the subject of that rdf piece is person.
foaf:name in the query will search for all the predicates of the form "<foaf:name>Dean Jackson</foaf:name>".
And the ?name part in the query will extract the value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment