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.

Page revision history

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

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 10 removed one line
At line 14 added one line
! Classes
At line 16 removed 2 lines
! Classes
At line 19 changed one line
si:ApplianceConcept a rdfs:Class.
si:SimpsonsConcept a rdfs:Class.
At line 21 changed 2 lines
si:LivingBeing rdfs:subClassOf si:ApplianceConcept;
rdfs:label "Lebewesen"@de, "Living being".
si:LivingBeing rdfs:subClassOf si:SimpsonsConcept;
rdfs:label "Lebewesen"@de, "Living being"@en.
At line 26 removed one line
a rdfs:Class;
At line 68 removed one line
At line 148 removed one line
At line 160 removed one line
At line 192 changed one line
si:sibling si:lisa ;
si:sibling si:lisa, si:maggie ;
At line 250 added one line
!!! Sample Queries
At line 257 changed one line
%%SparqlVisualization
Ok, we can test/query the ontology by inserting some SPARQL statements.
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).
! Simple start
At line 256 added 7 lines
Show me all instances of Human and also show their labels.
%%Sparql
SELECT ?x ?name
WHERE {
?x rdf:type si:Human ;
rdfs:label ?name .
At line 274 changed 2 lines
@rankDir: BT
@size: 1200
@border: true
@zebramode: true
@showQuery: true
At line 269 added one line
! Barts Grand-Pa
At line 271 added 95 lines
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 ?husband
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
%
At line 289 changed one line
@ruleset: OWL2_RL_REDUCED_OPTIMIZED
@ruleset: OWL_HORST_OPTIMIZED_WITH_PROPERTY_CHAINS
At line 292 changed one line
Let's us the namespace {{si}} for the resources.
Let's use the namespace {{si}} for the resources.