This page (revision-64) was last changed on 05-May-2021 20:05 by Albrecht Striffler

This page was created on 24-Jun-2014 12:41 by Joba Baumeister

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Version Date Modified Size Author Changes ... Change note
64 05-May-2021 20:05 7 KB Albrecht Striffler to previous
63 05-May-2021 20:04 7 KB Albrecht Striffler to previous | to last
62 09-Dec-2019 14:24 7 KB Albrecht Striffler to previous | to last
61 09-Dec-2019 14:23 7 KB Albrecht Striffler to previous | to last

Difference between version and

At line 19 changed one line
si:ApplianceConcept a rdfs:Class.
si:SimpsonsConcept a rdfs:Class.
At line 21 changed one line
si:LivingBeing rdfs:subClassOf si:ApplianceConcept;
si:LivingBeing rdfs:subClassOf si:SimpsonsConcept;
At line 34 changed one line
rdfs:subClassOf si:ApplianceConcept ;
rdfs:subClassOf si:SimpsonsConcept ;
At line 46 changed one line
rdfs:subClassOf si:ApplianceConcept ;
rdfs:subClassOf si:SimpsonsConcept ;
At line 50 changed one line
rdfs:subClassOf si:ApplianceConcept ;
rdfs:subClassOf si:SimpsonsConcept ;
At line 141 changed one line
rdfs:subClassOf si:ApplianceConcept.
rdfs:subClassOf si:SimpsonsConcept.
At line 257 changed one line
%%SparqlVisualization
!!! Sample Queries
At line 259 changed 13 lines
SELECT ?x ?y ?z WHERE {
?x ?y ?z .
FILTER (STRSTARTS(STR(?x), "http://www.example.org/ontology#")).
FILTER (STRSTARTS(STR(?z), "http://www.example.org/ontology#")).
FILTER NOT EXISTS {?x rdf:type rdfs:Class}.
FILTER NOT EXISTS {?z rdf:type rdfs:Class}.
FILTER NOT EXISTS {?x rdf:type rdf:Property}.
FILTER NOT EXISTS {?z rdf:type rdf:Property}.
FILTER (?y != si:relatedWith).
FILTER (?y != si:parent).
FILTER (?y != si:child).
FILTER (?y != si:grandparent).
FILTER (?z != ?x).
Ok, we can test/query the ontology by inserting some SPARQL statements.
At line 261 added 10 lines
! Simple start
Show me all instances of Human and also show their labels.
%%Sparql
SELECT ?x ?name
WHERE {
?x rdf:type si:Animal ;
rdfs:label ?name .
At line 274 changed 2 lines
@rankDir: BT
@size: 1200
@border: true
@zebramode: true
@showQuery: true
At line 278 added 102 lines
! Barts Grand-Pa
Use property paths in SPARQL.
%%Sparql
SELECT ?name
WHERE {
si:bart si:father/si:father ?name .
}
@border: true
@zebramode: true
@showQuery: true
%
Now using a defined PropertyChain
%%Sparql
SELECT ?name
WHERE {
si:bart si:grandparent ?name .
}
@border: true
@zebramode: true
@showQuery: true
%
! Optional belongings
We also can add optional patterns into the query. Show all humans and their (optional) belongings.
%%Sparql
SELECT ?name ?belonging
WHERE {
?x rdf:type si:Human ;
rdfs:label ?name .
OPTIONAL { ?x si:owns/si:ownType/rdfs:label ?belonging } .
}
@border: true
@zebramode: true
@showQuery: true
%
! UNION: All names of humans and animals
%%Sparql
SELECT ?name
WHERE {
{ ?x rdf:type si:Human ;
rdfs:label ?name .
} UNION {
?x rdf:type si:Animal ;
rdfs:label ?name .
}
}
@border: true
@zebramode: true
@showQuery: true
%
! Expected Compentency Questions: Intersecting Properties
The family father: A father that is also a husband
%%Sparql
SELECT ?name
WHERE {
?husband si:father ?kid ;
rdfs:label ?name .
?wife si:husband ?husband .
}
@border: true
@zebramode: true
@showQuery: true
%
! Hierarchical Table
%%Sparql
SELECT (SAMPLE(?sub) as ?sub) (SAMPLE(?par) as ?par) (SAMPLE(?name) as ?name) ?concept
WHERE {
{
# bind si:abraham as root node
BIND (si:abraham as ?sub) .
}
UNION
{
# collect all parent child relations (will be conntected automagically to si:abraham)
?sub si:parent ?par ;
}
# display name and concept as table columns
?sub rdfs:label ?name .
BIND (?sub as ?concept) .
} GROUP BY ?concept
@tree: true
@showQuery: true
%