Unraveling Multimodality with Large Language Models.pdf
Sparql a simple knowledge query
1. SPARQL : A Simple Knowledge Query
STANLEY WANG
SOLUTION ARCHITECT, TECH LEAD
@SWANG68
http://www.linkedin.com/in/stanley-wang-a2b143b
2. Querying RDF data
• RDF is a directed, labeled graph data format for representing
the first layer information in semantic web standards;
• Query patterns are like RDF triples except that each of the
subject, predicate and object may be a variable;
SPARQL
• W3C standard recommendation in Q3 2007
• A query language based on graph patterns
• Protocol layer for using SPARQL over HTTP
• SPARQL endpoints on the Web
• SPARQL used to construct graphs
SPARQL stands for Protocol
and RDF Query Language
3. 3
SPARQL as a Unifying Source
SPARQL in 3 Parts
1. Query Language
2. Result Format
3. Access Protocol
4. SPARQL Query
SELECT ...
FROM ...
WHERE { ... }
SELECT clause to identify the values to
be returned
FROM clause to identify the data
sources to query
WHERE clause the triple/graph pattern to be matched
against the triples/graphs of RDF
a conjunction of triples:
{ ?x rdf:type ex:Person
?x ex:name ?name }
PREFIX
declare the schema used
in the query
5. Example Persons and their Names
5
PREFIX ex: <http://inria.fr/schema#>
SELECT ?person ?name
WHERE {
?person rdf:type ex:Person
?person ex:name ?name .
}
7. with HTTP Binding
GET /sparql/?query=<encoded query> HTTP/1.1
Host: www.inria.fr
User-agent: my-sparql-client/0.1
SPARQL Protocol
• Sending Queries and their Results Across the Web
with SOAP Binding
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<query-request xmlns="http://www.w3.org/2005/09/sparql-
protocol-types/#">
<query>SELECT ?x ?p ?y WHERE {?x ?p ?y}</query>
</query-request>
</soapenv:Body>
</soapenv:Envelope>
8. • We need to associate a number of factors, including
hospital type and facilities – its accessibility after a
disaster – and the staff available
• The query needs to be structured based on Concepts &
Relationships that can be retrieved and then customized
for the specific query.
• Using this approach, a listing of the hospitals capable of
dealing with large number of burn cases is returned to
the user and information associated with the query
retrieved.
A “Simple” Knowledge Query
Which hospitals within 30 mins of Alpine, CA
provide burn treatment?”