3. Definitions and Motivation
โข Statement (or triple):
โ Small piece of knowledge (a single fact).
โ It has Subject-Predicate-Object.
โ Ex. Evidence A is_a physiotherapy evidence.
โ Ex. <subj0> <pred0> <obj0>
โข Subject (resource) and Object (value):
โ Names for things in the world.
โข Predicate (property):
โ Name of a relation that connects two things.
3
4. Definitions and Motivation
โข Semantic Web:
โ It is built on top of the current Web.
โ Besides the HTML constructs, it contains some
โstatementsโ that can be collected by an agent.
โ The agent organizes and connects the statements
into a graph format (data integration).
โ Automatic data integration on the Web can be
powerful and can help a lot when it comes to
information discovery and retrieval.
4
5. Definitions and Motivation
โข Query-based-language:
โ The agent should be able to process some
common queries that are submitted against the
statements it has collected. After all, without
providing a query interface, the collected
statements will not be of too much use to us.
5
6. Definitions and Motivation
โข Linked Data:
โ A collection of machine-understandable
statements, published without having them
related to any Web site at all.
โข Web of Data:
โ Interchangeable terms for the Semantic Web.
6
7. Definitions and Motivation
โข Resource description framework (RDF):
โ The building block for the Semantic Web.
โ Standard for encoding metadata.
โข Metadata: describe the data contained on the Web.
โข Machine understandable (also interoperability).
โข Domain independent.
โ Describe any resources and their relations existing
in the real world.
โ RDF is for the Semantic Web what HTML has been
for the Web.
7
8. Definitions and Motivation
โข RDF Schema (RDFS):
โ Stands for RDF Schema.
โ Common language, or, a vocabulary, where
classes, sub-classes, properties, and also relation
between the classes and properties are defined.
โ Domain-specific.
โ Allow the creation of distributed RDF documents.
8
9. Definitions and Motivation
โข Web Ontology Language (OWL):
โ Is the most popular language to use when creating
ontologies.
โ Is build upon RDF Schema.
โ Has the same purpose as RDF Schema.
โข Classes, properties, and their relationships for a specific
application domain.
โ Provides the capability to express much more
complex and richer relationships (better
expressiveness).
9
10. Definitions and Motivation
โข Web Ontology Language (OWL):
โ Axiom: basic statement (basic piece of
knowledge).
โ A collection of axioms is an OWL Ontology.
โ Protรฉgรฉ is free OWL editor.
โข IRI:
โ Stands for Internationalized Resource Identifiers
(like URIs with Unicode characters).
10
11. Definitions and Motivation
โข Computer Ontology:
โ Reflects the structure of the world.
โ Is often about structure of the concepts.
โ Each statement collected by an agent represents a
piece of knowledge. Therefore, there has to be a
way (a model) to represent knowledge on the
Web. Furthermore, this model of representing
knowledge has to be easily and readily processed
(understood) by machines.
11
12. Definitions and Motivation
โข Computer Ontology:
โ An application can understand a given ontology;
that means the application can parse the ontology
and create a list of axioms based on the ontology,
and all the facts are expressed as RDF statements.
12
14. SPARQL
โข SPARQL: Querying the Semantic Web.
โ Pronounced โsplarkleโ
โ Stands for SPARQL Protocol and RDF Query
Language.
โ Locate specific information on the machine-
readable Web.
โ The Web can be viewed as a gigantic database.
14
15. SPARQL (cont)
โข Related concepts:
โ RDF data store: is a special database system built
for the storage and retrieval of RDF statements.
โข Every record is a short statement in the form of
subject-predicate-object.
โข Store RDF statements and retrieve them by using a
query language.
โ Triple pattern: any or all the subject, predicate,
and object values can be a variable.
โข <http://danbri.org/foaf.rdf#danbri> foaf:name ?name.
15
16. SPARQL (cont)
โข Graph pattern: is used to select triples from a
given RDF graph.
โ Is a collection of triple patterns.
โ { ?who foaf:name ?name.
?who foaf:interest ?interest.
?who foaf:knows ?others. }
โ Note: FOAF (friend of a friend) is an Ontology (a
group of properties that describes a person) and a
collection of RDF statements.
16
17. SPARQL (cont)
โข SPARQL engine:
โ Tries to match the triples contained in the graph
patterns against the RDF graph, which is a
collection of triples.
โ Once a match is successful, it will bind the graph
patternโs variables to the graphโs nodes, and one
such variable binding is called a query solution.
17
18. SPARQL (cont)
โข SPARQL endpoint:
โ Interface that users (human or apps) can access to
query an RDF data store by using SPARQL query
language.
โข Web-based application.
โข Set of APIs that can be used by an agent.
โ Ex. Joseki Web-based SPARQL.
โข http://sparql.org/sparql.html
18
20. SPARQL (cont)
โข Structure of a SELECT Query:
โ # base directive
BASE <URI>
# list of prefixes
PREFIX pref: <URI>
...
# result description
SELECT...
# graph to search
FROM . . .
# query pattern
WHERE {
...
}
# query modifiers
ORDER BY... 20
21. SPARQL (cont)
โข Ex. Find all the picture formats used by Dan Brickleyโs friends (from graph
http://danbri.org/foaf.rdf#danbri).
21
22. SPARQL (cont)
โข The query finds all the picture format used by Dan Bricley's friends.
โข Base define the source file (graph) which link is: http...
โข prefix define the ontology of persons foaf which link is: http...
โข the other prefix define the image format ontology dc which link is: http...
โข select * from the source graph
โข where is defined the term dambri in the foaf ontology throw the knows
attribute and store that information in the variable ?friend
โข where ?friend has a description of the image throw the attribute
foaf:depiction and store that information in the variable ?picture
โข where ?picture has the name of the image format throw attribute
dc:format and store the name in the variable ?imageFormat
22
24. SPARQL (cont)
โข Optional keyword: is needed because RDF
data graph is only a semi-structured data
model.
โ i.e. two instances of the same class type in a given
RDF graph may have different set of property
instances created for each one of them.
โ The query says, find all the people known by Dan
Brickley and show their name, e-mail, and home
page information if any of this information is
available.
24
27. SPARQL (cont)
โข Solution modifiers:
โ Distinct: eliminate duplicate solutions from the
result.
โ Order by:
โข Asc (): ascending.
โข Desc (): descending.
โ Limit: set the maximum number of solutions.
โ Offset: sets the number of solutions to be skipped.
27
29. SPARQL (cont)
โข Union keyword:
โ A query expressed by multiple graph patterns that
are mutually exclusive, and any solution will have
to match exactly one of these patterns
(alternative match).
29
31. SPARQL (cont)
โข Construct query:
โ Returns a new RDF graph.
โข Describe query:
โ Return an RDF graph whose statement are
determined by the query processor.
โข Ask query:
โ The query processor simply returns a true or false
value.
31
33. SPARQL (cont)
โข Other operators and functions:
โ NOT EXISTS
โ MINUS
โ Concat() : for expressions in a query.
โ INSERT DATA
โ DELETE DATA
โ CREATE [SILENT] GRAPH <uri>
โ DROP [SILENT] GRAPH <uri>
33
34. References
โข Liyang Yu (2011). A Developerโs Guide to the
Semantic Web. Springer. ISBN: 978-3-642-
15969-5.
โข (2011) Huang J, Abadi D.J. and Ren K. Scalable
SPARQL Querying of Large RDF Graphs.
34