You are here:
/ Dashboard / Main / ODSFOAFRef

ODS FOAF References

This article outlines the mapping of ODS data to the FOAF ontology for the purpose of constructing SPARQL Queries against OpenLink Data Spaces ODS Data.

You can actually create you own Data Spaces and then experiment with these queries by opening accounts at: http://demo.openlinksw.com/ods (for very temporary and volatile usage) or http://myopenlink.net:8890/ods (for less volatile usage)

You can run most (if not all) of the queries with minimal modification using the following SPARQL Query Services: http://demo.openlinksw.com/sparql/ (using the 'demo' user account) and http://myopenlink.net:8890/sparql/ (assuming you have an account with this service)

Weblog Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?nick, ?fname, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:Weblog .
    ?forum sioc:container_of ?post.
    optional{ ?post foaf:maker ?maker }.
    optional{ ?maker foaf:nick ?nick } .
    optional{ ?maker foaf:name ?fname } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Weblog Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of blog posts.

Addressbook Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?nick, ?fname, ?post, ?aimChatID, ?based_near, ?birthday, 
?family_name, ?firstName, ?gender, ?homepage, ?icqChatID, ?mbox, ?msnChatID, ?phone, ?yahooChatID
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
     ?forum a sioct:AddressBook .
     ?forum sioc:container_of ?post.
     optional{ ?post foaf:maker ?maker }.
     optional{ ?maker foaf:nick ?nick  } .
     optional{ ?maker foaf:name ?fname } .
     optional{ ?maker foaf:aimChatID ?aimChatID  } .
     optional{ ?maker foaf:based_near ?based_near } .
     optional{ ?maker foaf:birthday ?birthday } .
     optional{ ?maker foaf:family_name ?family_name } .
     optional{ ?maker foaf:firstName ?firstName } .
     optional{ ?maker foaf:gender ?gender } .
     optional{ ?maker foaf:homepage ?homepage } .
     optional{ ?maker foaf:icqChatID ?icqChatID } .
     optional{ ?maker foaf:mbox ?mbox } .
     optional{ ?maker foaf:msnChatID ?msnChatID } .
     optional{ ?maker foaf:phone ?phone } .
     optional{ ?maker foaf:yahooChatID ?yahooChatID } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Addressbook Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of AddressBook? posts.

Calendar Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?nick, ?fname, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:Calendar .
    ?forum sioc:container_of ?post.
    optional{ ?post foaf:maker ?maker }.
    optional{ ?maker foaf:nick ?nick  } .
    optional { ?maker foaf:name ?fname } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Calendar Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of calendar events.

Wiki Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?nick, ?org, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a  sioct:Wiki .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:nick ?nick  } .
    optional { ?maker foaf:organization ?org } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Wiki Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a Collection of Wikis.

Feeds / Subscriptions Data Space (Feed Aggregation)


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?fname, ?msn, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:SubscriptionList .
    ?forum sioc:parent_of ?parentf .
    ?parentf sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:name ?fname } .
    optional { ?maker foaf:msnChatID ?msn } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Feeds Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of Feed Subscriptions.

Bookmarks Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?fname, ?phone, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:BookmarkFolder .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:firstName ?fname  } .
    optional { ?maker foaf:phone ?phone } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of an ODS Bookmarks Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of published bookmarks.

Photo Gallery Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?icq, ?yid, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:ImageGallery .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:icqChatID ?icq  } .
    optional { ?maker foaf:yahooChatID ?yid } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of an ODS Photo Gallery Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of published Photos.

Community (Group Mode) Applications Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?fname, ?msn, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioc:Community .
    ?forum sioc:has_part ?parentf .
    ?parentf sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:name ?fname } .
    optional { ?maker foaf:msnChatID ?msn } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of an ODS Community Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of Community posts.

Briefcase Applications Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?gender, ?fname, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:Briefcase .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:gender ?gender  } .
    optional { ?maker foaf:family_name ?fname } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Briefcase Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of Briefcase Resources.

Polls Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?nick, ?fname, ?post
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:SurveyCollection .
    ?forum sioc:container_of ?post.
    optional{ ?post foaf:maker ?maker }.
    optional{ ?maker foaf:nick ?nick } .
    optional{ ?maker foaf:name ?fname } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Polls Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of polls posts.

Discussion Data Space


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?forum_name, ?post, ?mbox
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:MessageBoard .
    ?forum sioc:id ?forum_name.
    ?forum sioc:container_of ?post.
    optional{ ?post foaf:maker ?maker }.
    optional{ ?maker foaf:mbox ?mbox } .
  }

Sample Data (Live Query Results)
  • Click *Here* for an Interactive-Web View of Discussion Data Space
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of Discussion posts.

#Users

Users Projects


PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://rdfs.org/sioc/ns#>
PREFIX sioc:   <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc:  <http://purl.org/dc/elements/1.1/>
SELECT ?project ?title ?id ?descr 
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  { ?usr rdf:type sioc:User.
    ?usr rdfs:account_of ?sr .
    optional {?sr foaf:project ?project}.
    optional {?project dc:title ?title}.
    optional {?project dc:identifier ?id}.
    optional {?project dc:description ?descr}.  
  }

Sample Data (Live Query Results)
  • Click Here for a live SPARQL Query (via SPARQL Protocol) against a collection of Users Projects.

Using SPARQL CONSTRUCT to Export FOAF based RDF Data Sets

CONSTRUCT based SPARQL queries are very useful when trying to expose RDF (via a SPARQL Endpoint) to RDF Data Set consumers that do not support SPARQL. In a sense, the SPARQL CONSTRUCT statements as part of a SPARQL Protocol payload deliver a Data Web (Web 3.0) Experience to Interactive-Web Clients (Web 1.0).

Weblog posts sender nick and name details


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT
{
  ?post foaf:maker ?maker .
  ?maker foaf:nick ?nick .
  ?maker foaf:name ?fname .
}
FROM <http://demo.openlinksw.com/dataspace>
WHERE
   {
    ?forum a sioct:Weblog .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:nick ?nick  } .
    optional { ?maker foaf:name ?fname } .
  }

Wiki articles creator nick and organization details


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT
  {
    ?post foaf:maker ?maker .
    ?maker foaf:nick ?nick  .
    ?maker foaf:organization ?org  .
  }
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:Wiki .
    ?forum sioc:container_of ?post.
    optional { ?post foaf:maker ?maker }.
    optional { ?maker foaf:nick ?nick  } .
    optional { ?maker foaf:organization ?org } .
  }

Bookmarks link's creator first name and phone details


PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX sioct: <http://rdfs.org/sioc/types#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
CONSTRUCT
  {
    ?post foaf:maker ?maker .
    ?maker foaf:firstName ?fname .
    ?maker foaf:phone ?phone .
  }
FROM <http://demo.openlinksw.com/dataspace>
WHERE 
  {
    ?forum a sioct:BookmarkFolder .
    ?forum sioc:container_of ?post.
    optional{ ?post foaf:maker ?maker }.
    optional{ ?maker foaf:firstName ?fname  } .
    optional{ ?maker foaf:phone ?phone } .
  }

References

Specs

FAQs

Presentations

Tutorials

Learn More

Virtuoso and the Virtuoso Website are Copyright (C) OpenLink Software 2006-
SourceForge.net Logo