- Tutorial SIOC Reference
- List of Tutorial sioc:Post attributes
- Sample Data (Live Query Results)
- List of Containers(Sections) and foaf:Documents(Tutorials)
- Sample Data (Live Query Results)
- List of Posts (Tutorials) with content
- Sample Data (Live Query Results)
- List of Posts (Tutorials) with content HTML encoded
- Sample Data (Live Query Results)
- References
- Specs
- FAQs
- Presentations
- Tutorials
- Learn More
- Problematic queries:
!! NOT to be published until the problematic queries from the end of the articles are fixed by Aziz
Tutorial SIOC Reference
This article demonstrates how we expose the underlying data that drives the Virtuoso Online Tutorials & Demo application using the SIOC ontology.Note: You can run most (if not all) of the queries with minimal modification using the following SPARQL Query Services: http://demo.openlinksw.com/sparql/
| Tutorial | SIOC | Sample Value |
|---|---|---|
| Tutorials | rdf:type | sioc:Space |
| Section | rdf:type | sioc:Container |
| Post | rdf:type | foaf:Document |
| Post | subclass of | sioc:Item |
| Post | description | sioc:description |
| Post | content | sioc:content |
List of Tutorial sioc:Post attributes
* content * description * has_container
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
SELECT distinct ?attribute
FROM <http://demo.openlinksw.com/tutorial>
WHERE
{
?forum a sioc:Container .
?forum rdf:type "Tutorial" .
?forum sioc:container_of ?post .
?post ?attribute ?o
}
ORDER BY ?attribute
Sample Data (Live Query Results)
- Click *Here* for an Interactive-Web View of Virtuoso Tutorials.
- Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Virtuoso Tutorials.
List of Containers(Sections) and foaf:Documents(Tutorials)
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?forum_name, ?title, ?post as ?url, ?created_at, ?description
FROM <http://demo.openlinksw.com/tutorial>
WHERE
{
?forum rdf:type "Tutorial".
?forum sioc:description ?forum_name.
?forum sioc:container_of ?post.
?post rdf:type foaf:Document.
optional{ ?post dc:title ?title } .
optional{ ?post dcterms:created_at ?created_at} .
optional{ ?post sioc:description ?description} .
}
ORDER BY DESC (?created_at)
Sample Data (Live Query Results)
- Click *Here* for an Interactive-Web View of Virtuoso Tutorials.
- Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Virtuoso Tutorials.
List of Posts (Tutorials) with content
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?forum_name, ?title, ?post as ?url, ?content
FROM <http://demo.openlinksw.com/tutorial>
WHERE
{
?forum rdf:type "Tutorial".
?forum sioc:description ?forum_name.
?forum sioc:container_of ?post.
?post rdf:type foaf:Document.
optional{ ?post dc:title ?title } .
optional{ ?post sioc:content ?content} .
}
LIMIT 10
Sample Data (Live Query Results)
- Click *Here* for an Interactive-Web View of Virtuoso Tutorials.
- Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Virtuoso Tutorials.
List of Posts (Tutorials) with content HTML encoded
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX content: <http://purl.org/rss/1.0/modules/content/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT DISTINCT ?forum_name, ?title, ?post as ?url, ?content_encoded
FROM <http://demo.openlinksw.com/tutorial>
WHERE
{
?forum rdf:type "Tutorial".
?forum sioc:description ?forum_name.
?forum sioc:container_of ?post.
?post rdf:type foaf:Document.
optional{ ?post dc:title ?title } .
optional{ ?post content:encoded ?content_encoded } .
}
LIMIT 10
Sample Data (Live Query Results)
- Click *Here* for an Interactive-Web View of Virtuoso Tutorials.
- Click *Here* for a live SPARQL Query (via SPARQL Protocol) against a collection of Virtuoso Tutorials.
References
Specs
FAQs
Presentations
- SPARQL Introduction - Dave Beckett, XTech 2004
- SPARQL Introduction - Dave Beckett, Standford University Presentation
- SPARQL Query Protocol presentation at XTech 2006 by Leigh Dodds
- SPASQL - Initiative to add SPARQL to MySQL?
Tutorials
- SPARQL Tutorial by Cristina Feier from the DERI? Project
- SPARQL Tutorial - Clark+Prasia & University of Manchester Tutorial
- Jena SPARQL Tutorial
Learn More
- ODS SIOC reference
- Query ODS Data Spaces using SPARQL and Atom OWL Ontology
- Query ODS Data Spaces using SPARQL and SKOS Ontology
- Query ODS Data Spaces using SPARQL and FOAF Ontology
- Query ODS Data Spaces using SPARQL and Annotea Ontology
- ODS SPARQL Samples
- Northwind SPARQL Reference
- Query Virtuoso Documentation using SPARQL
- WordPress SIOC Reference
- MedaWiki SIOC Reference
- PHPBB SIOC Reference
- Drupal SIOC Reference
Problematic queries:
-- returns for all items found empty values for ?ident, ?content, ?type and ?presentedAt.
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX tutorial: <http://demo.openlinksw.com/schemas/tutorial#>
SELECT *
FROM <http://localhost:8890/tutorial_view>
WHERE
{
?ps a tutorial:Post .
?ps a foaf:Document .
?ps a bibo:Article .
optional{?ps bibo:identifier ?ident}.
optional{?ps bibo:author ?author}.
optional{?ps tutorial:belongs_to_section ?belong}.
optional{?ps sioc:content ?content}.
optional{?ps tutorial:type ?type}.
optional{?ps bibo:presentedAt ?presentedAt}.
optional{?ps bibo:url ?url}.
}
-- returns error:
37000 Error SP031: SPARQL compiler: No one quad map pattern is suitable for GRAPH <http://localhost:8890/tutorial_view> { ?pt <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://demo.openlinksw.com/schemas/tutorial#Section> } triple at line 9
in
sparql_to_sql_text:(BIF),
<Top Level>
SPARQL query:
define sql:signal-void-variables 1 define output:valmode "LONG" define input:default-graph-uri <http://localhost:8890/tutorial_view> prefix bibo:
....
prefix bibo: <http://purl.org/ontology/bibo/>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX tutorial: <http://demo.openlinksw.com/schemas/tutorial#>
SELECT *
FROM <http://localhost:8890/tutorial_view>
WHERE
{
?pt a tutorial:Section .
?pt a sioc:Container .
?pt a bibo:Collection .
?pt a bibo:identifier .
}
-- returns error:
37000 Error SP031: SPARQL compiler: No one quad map pattern is suitable for GRAPH <http://localhost:8890/tutorial_view> { ?forum <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/ns#Container> } triple at line 8
in
sparql_to_sql_text:(BIF),
<Top Level>
SPARQL query:
define sql:signal-void-variables 1 define output:valmode "LONG" define input:default-graph-uri <http://localhost:8890/tutorial_view> PREFIX rdf:
....
List of all Sections and their Posts:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
prefix tutorial: <http://demo.openlinksw.com/schemas/tutorial#>
SELECT *
from <http://localhost:8890/tutorial_view>
WHERE
{
?forum a sioc:Container .
?forum rdf:type tutorial:Section .
?forum sioc:is_container_of ?post .
}
limit 50
-- returns nothing:
List of all Posts and their sections:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX sioc: <http://rdfs.org/sioc/ns#>
prefix tutorial: <http://demo.openlinksw.com/schemas/tutorial#>
prefix foaf: <http://xmlns.com/foaf/0.1/>
SELECT *
from <http://localhost:8890/tutorial_view>
WHERE
{
?forum rdf:type tutorial:Post .
?forum sioc:description ?forum_name.
?forum tutorial:belongs_to_section ?belongs_to_section
}
limit 50