Database Reference
In-Depth Information
ANALYSIS OF SEMANTIC WEB
ONTOLOGY QUERY LANGUAGES
SELECT ?i
WHERE {?i rdf:type sioc:Item}
A lot of ontology query languages have been
proposed in the context of the Semantic Web. In
a recent survey (Bailey et al., 2005), these lan-
guages are classified in seven categories (SPARQL
family, RQL family, languages inspired from
XPath, XSLT or XQuery, languages in controlled
English, languages with reactives rules, deductive
languages and other languages). In this section,
we present a representative language of the two
first categories that fit the most with the require-
ments we have defined.
Explanation . The triple in the FROM clause
introduces the variable ?i (a variable is prefixed
by ?) to iterate over instances of the class Item.
This variable is specified in the SELECT clause
to return its values.
However, the result of the previous query de-
pends on the triples represented in the OBDB. On
the one hand, if for a class C, a triple (i, rdf:type,
C) is represented for each direct or indirect instance
of C, then the previous query returns also all the
instances of the class Post subclass of Item. On the
other hand, if a triple (i, rdf:type, C) is represented
only for each direct instance of C, then the query
returns only direct instances of C unless the query
interpreter computes the transitive closure of the
subsumption relationship. Thus, the SPARQL ful-
fill partially this requirement. Ontological queries
can be expressed but their results depend on the
represented triples or of their interpretation.
SPARQL
The first category of language is named “SPARQL
familiy”. It is composed of the languages SPARQL
(Prud'hommeaux and Seaborne, 2008), RDQL
(Seaborne, 2004), SquishQL (Miller et al., 2002)
and TriQL (Caroll et al., 2005). These languages
consider all information (both ontologies and
instances data) as a set of RDF triples (subject,
predicate, object). As a representative we have
chosen SPARQL which is a W3C Recommen-
dation.
SPARQL is a graph-matching query lan-
guage. A query consists of a pattern (a set of
triples with variables and filters) defined in the
WHERE clause. This pattern is matched against
a data source, and the values obtained from this
matching are processed in the SELECT clause to
give the answer. We describe more precisely this
language by discussing its capability w.r.t. the
defined requirements.
Requirement 2 (Definition of
non canonical concepts)
SPARQL does not provide a data definition lan-
guage. Thus, it can not be used to define non ca-
nonical concepts. However, if these concepts have
been defined in the data source, SPARQL provides
a CONSTRUCT query form that can be used to
compute automatically their instances. Example .
Compute instances of the class PostDupont
CONSTRUCT ?p rdf:type
sioc:PostDupont
WHERE {?p rdf:type sioc:Post . ?p
sioc:has_creator “Dupont”}
Requirement 1 (Queries at
the ontological level)
Explanation. The WHERE clause retrieves
instances (?p) of the class Post created by the user
Dupont. The CONSTRUCT clause replaces the
traditional SELECT clause. It is constructed as a
WHERE clause (a set of triples with variables and
Example . The following SPARQL query 1 can be
used to rretrieve the instances of the class Item.
Search WWH ::




Custom Search