SlideShare ist ein Scribd-Unternehmen logo
1 von 29
Downloaden Sie, um offline zu lesen
©Cambridge Semantics Inc.
Company Confidential
SPARQL 101
Thomas Cook
Sales Director, AnzoGraph DB
Thomas.Cook@cambridgesemantics.com
©Cambridge Semantics Inc.
Company Confidential
▪ History lesson: What are the origins of SPARQL?
▪ Semantic Web
▪ Linked Open Data
▪ Knowledge Graphs
▪ What is RDF ?
▪ What’s a URI ?
▪ What is SPARQL?
Agenda
Origins of The Semantic Web
„The Semantic Web is an extension of the current web in which
information is given well-defined meaning, better enabling
computers and people to work in cooperation"
Tim Berners-Lee, James Hendler, Ora Lassila: The Semantic Web, Scientific American, 284(5), pp. 34-43(2001)
The World's Web Standards Organization
©Cambridge Semantics Inc.
Company Confidential
https://lod-cloud.net/
Linked Open Data
The dataset currently contains
1,239 datasets with 16,147 links
(Mar 2019)
Linked Data (name coined in 2006 by
Tim Berners-Lee)
©Cambridge Semantics Inc.
Company Confidential
https://wiki.dbpedia.org/about
DBPedia
DBpedia has information stored from 125 languages
DBpedia release consists of 3 billion pieces of information (RDF triples)
580 million were extracted from the English edition of Wikipedia
2.46 billion were extracted from other language editions
DBpedia is an open knowledge graph (OKG) which is available for everyone on the Web
A knowledge graph is a special kind of database which stores knowledge in a machine-readable form and
provides a means for information to be collected, organized, shared, searched and utilized
Google uses a similar approach to create those knowledge cards during search
©Cambridge Semantics Inc.
Company Confidential
http://mappings.dbpedia.org/server/ontology/classes/
DBPedia
Instances per class
Class Instances
Resource (overall) 4,233,000
Place 735,000
Person 1,450,000
Work 411,000
Species 251,000
Organisation 241,000
The DBpedia Ontology currently contains about 4,233,000 instances.
The table below lists the number of instances for several classes within
the ontology:
• http://dbpedia.org/snorql/?query=%23select+distinct+%3FConcept+w
here+%7B%5B%5D+a+%3FConcept%7D+LIMIT+100%0D%0A%0D
%0A%23Select+distinct+*+where+%7B+%3Fs+a+foaf%3APerson+%
7D+limit+100%0D%0A%0D%0ASelect+distinct+*+where+%7B+%3F
s+%3Fp+%3Fo+.%0D%0A%0D%0Afilter+%28regex%28%3Fs%2C+
%22Pacino%22%2C+%22i%22%29%29%0D%0A%7D+limit+100%0
D%0A%0D%0A+
SPARQL Explorer
RDF (Resource Description Framework) is the data model of the Semantic Web. That means
that all data in Semantic Web technologies is represented as RDF
RDF's simple data model and ability to model disparate, abstract concepts has also led to its
increasing use in knowledge management applications unrelated to Semantic Web activity
What is RDF ?
At the most atomic level,
RDF is made of Triples.
A “Triple” is a single fact
Subject Object
E.g. “The Sky is Blue”
Sky Blue
Color
Predicate
https://en.wikipedia.org/wiki/Resource_Description_Framework
RDF is not like the tabular data model of relational databases. Nor is it like the
trees of the XML world. Instead, RDF is a graph
It’s a labeled, directed graph.
RDF Graph
Alice Telsa
drives
Bill
friend_of
Austin
resident_of
<Alice> <drives> <Tesla> .
<Alice> <friend_of> <Bill> .
<Alice> <resident_of> <Austin>.
<Tesla> <color> “blue” .
RDF Serializations – Turtle, N-Triples, RDFa, JSON-LD
Alice Tesla
drives
Bill
friend_of
Austin
resident_of
color
“blue”
Resource nodes A resource is anything that can have things said about it. It’s easy to think of a
resource as a thing vs. a value. In a visual representation, resources are represented by ovals.
Literal nodes The term literal is a fancy word for value. In a visual representation, literals are
represented by rectangles.
Blank nodes
3 Types of Nodes
Alice Tesla
drives
Bill
friend_of
Austin
resident_of
color
“blue”
<Alice>
Expressed as a full URI would look something more like:
<http://example.com/resource/person#Alice>
And
<drives>
Would be more like:
<http://example.com/resource/person#drives>
URIs – Uniform Resource Identifier
How can we uniquely ID resources universally? Add a URL to the start of your ID.
<http://example.com/resource/person#Alice> <http://example.com/resource/person#drives> <http://example.com/resource/person#Tesla> .
<http://example.com/resource/person#Alice> <http://example.com/resource/person#friend_of> <http://example.com/resource/person#Bill> .
<http://example.com/resource/person#Alice> <http://example.com/resource/person#resident_of> <http://example.com/resource/person#Austin>.
<http://example.com/resource/car#Tesla> <http://example.com/car#color> “blue” .
SPARQL PREFIX abbreviation
BEFORE:
<http://example.com/resource/person#Alice> <http://example.com/resource/person#drives> <http://example.com/resource/car#Tesla
<http://example.com/resource/person#Alice> <http://example.com/resource/person#friend_of> <http://example.com/resource/person
<http://example.com/resource/person#Alice> <http://example.com/resource/person#resident_of> <http://example.com/resource#Aus
<http://example.com/resource#Tesla> <http://example.com/resource#color> “blue” .
With PREFIX we can get a much shorter representation with abbreviations.
AFTER:
PREFIX tslap: <http://example.com/resource/person#> .
PREFIX tslar: <http://example.com/resource#> .
tslap:Alice tslap:drives tslac:Tesla .
tslap:Alice tslap:friend_of tslap:Bill .
tslap:Alice tslap:resident_of tslar:Austin .
tslar:Tesla tslar:color “blue”.
<Alice> <drives> <Tesla> .
<Alice> <friend_of> <Bill> .
<Alice> <resident_of> <Austin>.
<Tesla> <color> “blue” .
Same as below without URIs, but
now universally uniquely identified
PREFIX Short For:
rdf: http://xmlns.com/foaf/0.1/
rdfs: http://www.w3.org/2000/01/rdf-schema#
owl: http://www.w3.org/2002/07/owl#
xsd: http://www.w3.org/2001/XMLSchema#
dc: http://purl.org/dc/elements/1.1/
foaf: http://xmlns.com/foaf/0.1/
Common Prefixes
More common prefixes at http://prefix.cc
SPARQL stands for:
SPARQL Protocol And RDF Query Language
A query language and a protocol
What is SPARQL?
A SPARQL QUERY:
SELECT …
FROM ….
WHERE { … }
GROUP BY …
ORDER BY …
SELECT – Identifies the values to return
FROM – selects the dataset to query
WHERE – the graph patterns to match
GROUP BY – group aggregations on this field
ORDER BY – order the result set
INSERT DATA { GRAPH <test1> {
<Alice> <drives> <Tesla> .
<Alice> <friend_of> <Bill> .
<Alice> <resident_of> <Austin>.
<Tesla> <color> "blue" .
}
}
Let’s INSERT some data
SELECT (count(*) as ?count)
FROM <test1>
WHERE {
?s ?p ?o .
}
RESULT:
count
--------
4
Let’s count how many triples are in the graph
SELECT ?s ?p ?o
FROM <test1>
WHERE {
?s ?p ?o .
}
Show all the triples
SELECT ?s
FROM <test1>
WHERE {
?s <drives> <Tesla> .
}
RESULT:
s
-------
Alice
1 rows
Use graph patterns to find data you want
Who drives a Tesla?
SELECT ?s
FROM <test1>
WHERE {
?s <drives> ?car .
?car <color> "blue" .
}
Who drives a blue car?
Join operation
Use graph patterns to match data in the graph
Who drives a blue car?
Join operation
Use graph patterns to match data in the graph
SELECT ?s ?color ?year
FROM <test1>
WHERE {
?s <drives> ?car .
?car <color> ?color .
?car <year> ?year .
}
RESULT? No results. Why? <year> does not exist in our graph
Graph patterns must exist in the WHERE
Who drives a car and what’s the color and year?
SELECT ?s ?color ?year
FROM <test1>
WHERE {
?s <drives> ?car .
?car <color> ?color .
OPTIONAL{?car <year> ?year . }
}
RESULT:
s | color | year
-------+-------+------
Alice | blue |
1 rows
Who drives a blue car?
USE OPTIONAL for Graph patterns that might not exist
• ORDER BY: This modifier sorts the result set in a particular order. It sorts query solutions on the
value of one or more variables.
• OFFSET: Using this modifier in conjunction with LIMIT and ORDER BY returns a slice of a sorted
solution set, for example, for paging.
• LIMIT: This modifier restricts the results to return a certain number of solutions.
• GROUP BY: This modifier is used with aggregate functions and specifies the key variables to use
to partition the solutions into groups. For information about AnzoGraph GROUP BY clause
extensions, see Advanced Grouping Sets.
• HAVING: This modifier is used with aggregate functions and further filters the results after
applying the aggregates.
SPARQL SELECT, like SQL, has several solution modifiers
The built-in SPARQL aggregate functions:
AVG: Calculates the average value for a numeric expression.
COUNT: Counts the number of times the specified value is bound to the given
variable.
GROUP_CONCAT: Performs a string concatenation of all of the values that are
bound to the given variable.
MAX: Returns the maximum value from the specified set of values.
MIN: Returns the minimum value from the specified set of values.
SAMPLE: Returns an arbitrary value from the specified set of values.
SUM: Adds the specified values.
Aggregate Functions
There are Four standard SPARQL query forms:
SELECT: Run SELECT queries when you want to find and return all of the data that
matches certain patterns.
CONSTRUCT: Run CONSTRUCT queries when you want to create or transform data
based on the existing data.
ASK: Run ASK queries when you want to know whether a certain pattern exists in the
data. ASK queries return only "true" or "false" to indicate whether a solution exists.
DESCRIBE: Run DESCRIBE queries when you want to view the RDF graph that
describes a particular resource.
Query Forms
©Cambridge Semantics Inc.
Company Confidential
©Cambridge Semantics Inc.
Company Confidential
info.anzograph@CambridgeSemantics.com
www.anzograph.com
AnzoGraph.com

Weitere ähnliche Inhalte

Was ist angesagt?

How to Build Modern Data Architectures Both On Premises and in the Cloud
How to Build Modern Data Architectures Both On Premises and in the CloudHow to Build Modern Data Architectures Both On Premises and in the Cloud
How to Build Modern Data Architectures Both On Premises and in the Cloud
VMware Tanzu
 
Hadoop Journey at Walgreens
Hadoop Journey at WalgreensHadoop Journey at Walgreens
Hadoop Journey at Walgreens
DataWorks Summit
 

Was ist angesagt? (20)

Verizon Centralizes Data into a Data Lake in Real Time for Analytics
Verizon Centralizes Data into a Data Lake in Real Time for AnalyticsVerizon Centralizes Data into a Data Lake in Real Time for Analytics
Verizon Centralizes Data into a Data Lake in Real Time for Analytics
 
Building Data Lakes with Apache Airflow
Building Data Lakes with Apache AirflowBuilding Data Lakes with Apache Airflow
Building Data Lakes with Apache Airflow
 
How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?How to boost your datamanagement with Dremio ?
How to boost your datamanagement with Dremio ?
 
2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledge2017-01-08-scaling tribalknowledge
2017-01-08-scaling tribalknowledge
 
Democratizing data science Using spark, hive and druid
Democratizing data science Using spark, hive and druidDemocratizing data science Using spark, hive and druid
Democratizing data science Using spark, hive and druid
 
Options for Data Prep - A Survey of the Current Market
Options for Data Prep - A Survey of the Current MarketOptions for Data Prep - A Survey of the Current Market
Options for Data Prep - A Survey of the Current Market
 
Charles Ivie
Charles Ivie Charles Ivie
Charles Ivie
 
Loan Decisioning Transformation
Loan Decisioning TransformationLoan Decisioning Transformation
Loan Decisioning Transformation
 
Building Custom Big Data Integrations
Building Custom Big Data IntegrationsBuilding Custom Big Data Integrations
Building Custom Big Data Integrations
 
Preparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/ML Preparing Your Data for Cloud Analytics & AI/ML
Preparing Your Data for Cloud Analytics & AI/ML
 
Choosing the Right Graph Database to Succeed in Your Project
Choosing the Right Graph Database to Succeed in Your ProjectChoosing the Right Graph Database to Succeed in Your Project
Choosing the Right Graph Database to Succeed in Your Project
 
Dealing With Drift - Building an Enterprise Data Lake
Dealing With Drift - Building an Enterprise Data LakeDealing With Drift - Building an Enterprise Data Lake
Dealing With Drift - Building an Enterprise Data Lake
 
Presto for apps deck varada prestoconf
Presto for apps deck varada prestoconfPresto for apps deck varada prestoconf
Presto for apps deck varada prestoconf
 
Bi on Big Data - Strata 2016 in London
Bi on Big Data - Strata 2016 in LondonBi on Big Data - Strata 2016 in London
Bi on Big Data - Strata 2016 in London
 
Дмитрий Лавриненко "Big & Fast Data for Identity & Telemetry services"
Дмитрий Лавриненко "Big & Fast Data for Identity & Telemetry services"Дмитрий Лавриненко "Big & Fast Data for Identity & Telemetry services"
Дмитрий Лавриненко "Big & Fast Data for Identity & Telemetry services"
 
New World Hadoop Architectures (& What Problems They Really Solve) for Oracle...
New World Hadoop Architectures (& What Problems They Really Solve) for Oracle...New World Hadoop Architectures (& What Problems They Really Solve) for Oracle...
New World Hadoop Architectures (& What Problems They Really Solve) for Oracle...
 
How to Build Modern Data Architectures Both On Premises and in the Cloud
How to Build Modern Data Architectures Both On Premises and in the CloudHow to Build Modern Data Architectures Both On Premises and in the Cloud
How to Build Modern Data Architectures Both On Premises and in the Cloud
 
Hadoop Journey at Walgreens
Hadoop Journey at WalgreensHadoop Journey at Walgreens
Hadoop Journey at Walgreens
 
How a Tweet Went Viral - BIWA Summit 2017
How a Tweet Went Viral - BIWA Summit 2017How a Tweet Went Viral - BIWA Summit 2017
How a Tweet Went Viral - BIWA Summit 2017
 
Big Data processing with Apache Spark
Big Data processing with Apache SparkBig Data processing with Apache Spark
Big Data processing with Apache Spark
 

Ähnlich wie AnzoGraph DB - SPARQL 101

Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
Emanuele Della Valle
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
Lino Valdivia
 
final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)
Ankit Rathi
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic Web
Jan Beeck
 

Ähnlich wie AnzoGraph DB - SPARQL 101 (20)

Introduction to metadata cleansing using SPARQL update queries
Introduction to metadata cleansing using SPARQL update queriesIntroduction to metadata cleansing using SPARQL update queries
Introduction to metadata cleansing using SPARQL update queries
 
A Little SPARQL in your Analytics
A Little SPARQL in your AnalyticsA Little SPARQL in your Analytics
A Little SPARQL in your Analytics
 
Re-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playoutRe-using Media on the Web: Media fragment re-mixing and playout
Re-using Media on the Web: Media fragment re-mixing and playout
 
Querying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQLQuerying the Semantic Web with SPARQL
Querying the Semantic Web with SPARQL
 
Triplestore and SPARQL
Triplestore and SPARQLTriplestore and SPARQL
Triplestore and SPARQL
 
NO SQL Databases, Big Data and the cloud
NO SQL Databases, Big Data and the cloudNO SQL Databases, Big Data and the cloud
NO SQL Databases, Big Data and the cloud
 
Apache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & librariesApache spark - Architecture , Overview & libraries
Apache spark - Architecture , Overview & libraries
 
final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)final_copy_camera_ready_paper (7)
final_copy_camera_ready_paper (7)
 
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
SQL – The Natural Language for Analysis - Oracle - Whitepaper - 2431343
 
Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013Annotating search results from web databases-IEEE Transaction Paper 2013
Annotating search results from web databases-IEEE Transaction Paper 2013
 
GraphDatabase.pptx
GraphDatabase.pptxGraphDatabase.pptx
GraphDatabase.pptx
 
Gerry McNicol Graph Databases
Gerry McNicol Graph DatabasesGerry McNicol Graph Databases
Gerry McNicol Graph Databases
 
SPARQL
SPARQLSPARQL
SPARQL
 
Sparql service-description
Sparql service-descriptionSparql service-description
Sparql service-description
 
Sustainable queryable access to Linked Data
Sustainable queryable access to Linked DataSustainable queryable access to Linked Data
Sustainable queryable access to Linked Data
 
SPARQL Query Forms
SPARQL Query FormsSPARQL Query Forms
SPARQL Query Forms
 
Semantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorialSemantic web meetup – sparql tutorial
Semantic web meetup – sparql tutorial
 
Visualizations using Visualbox
Visualizations using VisualboxVisualizations using Visualbox
Visualizations using Visualbox
 
SPARQL in the Semantic Web
SPARQL in the Semantic WebSPARQL in the Semantic Web
SPARQL in the Semantic Web
 
The Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQLThe Semantic Web #10 - SPARQL
The Semantic Web #10 - SPARQL
 

Mehr von Cambridge Semantics

Mehr von Cambridge Semantics (20)

Risk Analytics Using Knowledge Graphs / FIBO with Deep Learning
Risk Analytics Using Knowledge Graphs / FIBO with Deep LearningRisk Analytics Using Knowledge Graphs / FIBO with Deep Learning
Risk Analytics Using Knowledge Graphs / FIBO with Deep Learning
 
Using Machine Teaching in Text Analysis: Case Study on Using Machine Teaching...
Using Machine Teaching in Text Analysis: Case Study on Using Machine Teaching...Using Machine Teaching in Text Analysis: Case Study on Using Machine Teaching...
Using Machine Teaching in Text Analysis: Case Study on Using Machine Teaching...
 
Knowledge Graph Discussion: Foundational Capability for Data Fabric, Data Int...
Knowledge Graph Discussion: Foundational Capability for Data Fabric, Data Int...Knowledge Graph Discussion: Foundational Capability for Data Fabric, Data Int...
Knowledge Graph Discussion: Foundational Capability for Data Fabric, Data Int...
 
Graph-driven Data Integration: Accelerating and Automating Data Delivery for ...
Graph-driven Data Integration: Accelerating and Automating Data Delivery for ...Graph-driven Data Integration: Accelerating and Automating Data Delivery for ...
Graph-driven Data Integration: Accelerating and Automating Data Delivery for ...
 
Fireside Chat with Bloor Research: State of the Graph Database Market 2020
Fireside Chat with Bloor Research: State of the Graph Database Market 2020Fireside Chat with Bloor Research: State of the Graph Database Market 2020
Fireside Chat with Bloor Research: State of the Graph Database Market 2020
 
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
AnzoGraph DB: Driving AI and Machine Insights with Knowledge Graphs in a Conn...
 
Introduction to RDF*
Introduction to RDF*Introduction to RDF*
Introduction to RDF*
 
Using Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data FabricUsing Cloud Automation Technologies to Deliver an Enterprise Data Fabric
Using Cloud Automation Technologies to Deliver an Enterprise Data Fabric
 
Using a Semantic and Graph-based Data Catalog in a Modern Data Fabric
Using a Semantic and Graph-based Data Catalog in a Modern Data FabricUsing a Semantic and Graph-based Data Catalog in a Modern Data Fabric
Using a Semantic and Graph-based Data Catalog in a Modern Data Fabric
 
Healthcare and Life Sciences: Two Industries Separated by Common Data
Healthcare and Life Sciences: Two Industries Separated by Common DataHealthcare and Life Sciences: Two Industries Separated by Common Data
Healthcare and Life Sciences: Two Industries Separated by Common Data
 
Knowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data ScienceKnowledge Graph for Machine Learning and Data Science
Knowledge Graph for Machine Learning and Data Science
 
Modern Data Discovery and Integration in Insurance
Modern Data Discovery and Integration in InsuranceModern Data Discovery and Integration in Insurance
Modern Data Discovery and Integration in Insurance
 
Big Data Fabric 2.0 Drives Data Democratization
Big Data Fabric 2.0 Drives Data DemocratizationBig Data Fabric 2.0 Drives Data Democratization
Big Data Fabric 2.0 Drives Data Democratization
 
Modern Data Discovery and Integration in Retail Banking
Modern Data Discovery and Integration in Retail BankingModern Data Discovery and Integration in Retail Banking
Modern Data Discovery and Integration in Retail Banking
 
Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?Should a Graph Database Be in Your Next Data Warehouse Stack?
Should a Graph Database Be in Your Next Data Warehouse Stack?
 
Going Beyond Rows and Columns with Graph Analytics
Going Beyond Rows and Columns with Graph AnalyticsGoing Beyond Rows and Columns with Graph Analytics
Going Beyond Rows and Columns with Graph Analytics
 
Accelerate Pharma R&D with Cross-Study Analytics
Accelerate Pharma R&D with Cross-Study AnalyticsAccelerate Pharma R&D with Cross-Study Analytics
Accelerate Pharma R&D with Cross-Study Analytics
 
Accelerate Digital Transformation with an Enterprise Big Data Fabric
Accelerate Digital Transformation with an Enterprise Big Data FabricAccelerate Digital Transformation with an Enterprise Big Data Fabric
Accelerate Digital Transformation with an Enterprise Big Data Fabric
 
From Data Lakes to the Data Fabric: Our Vision for Digital Strategy
From Data Lakes to the Data Fabric: Our Vision for Digital StrategyFrom Data Lakes to the Data Fabric: Our Vision for Digital Strategy
From Data Lakes to the Data Fabric: Our Vision for Digital Strategy
 
The Year of the Graph
The Year of the GraphThe Year of the Graph
The Year of the Graph
 

Kürzlich hochgeladen

Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
gajnagarg
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
Health
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
wsppdmt
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
gajnagarg
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Klinik kandungan
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
vexqp
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
ranjankumarbehera14
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
vexqp
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
vexqp
 
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit RiyadhCytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Abortion pills in Riyadh +966572737505 get cytotec
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
nirzagarg
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
gajnagarg
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
vexqp
 

Kürzlich hochgeladen (20)

Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Surabaya ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
Top profile Call Girls In dimapur [ 7014168258 ] Call Me For Genuine Models W...
 
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
+97470301568>>weed for sale in qatar ,weed for sale in dubai,weed for sale in...
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Abortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get CytotecAbortion pills in Jeddah | +966572737505 | Get Cytotec
Abortion pills in Jeddah | +966572737505 | Get Cytotec
 
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
一比一原版(UCD毕业证书)加州大学戴维斯分校毕业证成绩单原件一模一样
 
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get CytotecAbortion pills in Doha Qatar (+966572737505 ! Get Cytotec
Abortion pills in Doha Qatar (+966572737505 ! Get Cytotec
 
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
Top profile Call Girls In bhavnagar [ 7014168258 ] Call Me For Genuine Models...
 
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
Jual obat aborsi Bandung ( 085657271886 ) Cytote pil telat bulan penggugur ka...
 
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
怎样办理旧金山城市学院毕业证(CCSF毕业证书)成绩单学校原版复制
 
Aspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - AlmoraAspirational Block Program Block Syaldey District - Almora
Aspirational Block Program Block Syaldey District - Almora
 
Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1Lecture_2_Deep_Learning_Overview-newone1
Lecture_2_Deep_Learning_Overview-newone1
 
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
怎样办理伦敦大学城市学院毕业证(CITY毕业证书)成绩单学校原版复制
 
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
怎样办理圣地亚哥州立大学毕业证(SDSU毕业证书)成绩单学校原版复制
 
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24  Building Real-Time Pipelines With FLaNKDATA SUMMIT 24  Building Real-Time Pipelines With FLaNK
DATA SUMMIT 24 Building Real-Time Pipelines With FLaNK
 
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit RiyadhCytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
Cytotec in Jeddah+966572737505) get unwanted pregnancy kit Riyadh
 
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
Top profile Call Girls In Bihar Sharif [ 7014168258 ] Call Me For Genuine Mod...
 
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
Top profile Call Girls In Chandrapur [ 7014168258 ] Call Me For Genuine Model...
 
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
怎样办理圣路易斯大学毕业证(SLU毕业证书)成绩单学校原版复制
 
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
SAC 25 Final National, Regional & Local Angel Group Investing Insights 2024 0...
 

AnzoGraph DB - SPARQL 101

  • 1. ©Cambridge Semantics Inc. Company Confidential SPARQL 101 Thomas Cook Sales Director, AnzoGraph DB Thomas.Cook@cambridgesemantics.com
  • 2. ©Cambridge Semantics Inc. Company Confidential ▪ History lesson: What are the origins of SPARQL? ▪ Semantic Web ▪ Linked Open Data ▪ Knowledge Graphs ▪ What is RDF ? ▪ What’s a URI ? ▪ What is SPARQL? Agenda
  • 3. Origins of The Semantic Web „The Semantic Web is an extension of the current web in which information is given well-defined meaning, better enabling computers and people to work in cooperation" Tim Berners-Lee, James Hendler, Ora Lassila: The Semantic Web, Scientific American, 284(5), pp. 34-43(2001)
  • 4. The World's Web Standards Organization
  • 5. ©Cambridge Semantics Inc. Company Confidential https://lod-cloud.net/ Linked Open Data The dataset currently contains 1,239 datasets with 16,147 links (Mar 2019) Linked Data (name coined in 2006 by Tim Berners-Lee)
  • 6. ©Cambridge Semantics Inc. Company Confidential https://wiki.dbpedia.org/about DBPedia DBpedia has information stored from 125 languages DBpedia release consists of 3 billion pieces of information (RDF triples) 580 million were extracted from the English edition of Wikipedia 2.46 billion were extracted from other language editions DBpedia is an open knowledge graph (OKG) which is available for everyone on the Web A knowledge graph is a special kind of database which stores knowledge in a machine-readable form and provides a means for information to be collected, organized, shared, searched and utilized Google uses a similar approach to create those knowledge cards during search
  • 7. ©Cambridge Semantics Inc. Company Confidential http://mappings.dbpedia.org/server/ontology/classes/ DBPedia Instances per class Class Instances Resource (overall) 4,233,000 Place 735,000 Person 1,450,000 Work 411,000 Species 251,000 Organisation 241,000 The DBpedia Ontology currently contains about 4,233,000 instances. The table below lists the number of instances for several classes within the ontology:
  • 9. RDF (Resource Description Framework) is the data model of the Semantic Web. That means that all data in Semantic Web technologies is represented as RDF RDF's simple data model and ability to model disparate, abstract concepts has also led to its increasing use in knowledge management applications unrelated to Semantic Web activity What is RDF ? At the most atomic level, RDF is made of Triples. A “Triple” is a single fact Subject Object E.g. “The Sky is Blue” Sky Blue Color Predicate https://en.wikipedia.org/wiki/Resource_Description_Framework
  • 10. RDF is not like the tabular data model of relational databases. Nor is it like the trees of the XML world. Instead, RDF is a graph It’s a labeled, directed graph. RDF Graph Alice Telsa drives Bill friend_of Austin resident_of
  • 11. <Alice> <drives> <Tesla> . <Alice> <friend_of> <Bill> . <Alice> <resident_of> <Austin>. <Tesla> <color> “blue” . RDF Serializations – Turtle, N-Triples, RDFa, JSON-LD Alice Tesla drives Bill friend_of Austin resident_of color “blue”
  • 12. Resource nodes A resource is anything that can have things said about it. It’s easy to think of a resource as a thing vs. a value. In a visual representation, resources are represented by ovals. Literal nodes The term literal is a fancy word for value. In a visual representation, literals are represented by rectangles. Blank nodes 3 Types of Nodes Alice Tesla drives Bill friend_of Austin resident_of color “blue”
  • 13. <Alice> Expressed as a full URI would look something more like: <http://example.com/resource/person#Alice> And <drives> Would be more like: <http://example.com/resource/person#drives> URIs – Uniform Resource Identifier How can we uniquely ID resources universally? Add a URL to the start of your ID. <http://example.com/resource/person#Alice> <http://example.com/resource/person#drives> <http://example.com/resource/person#Tesla> . <http://example.com/resource/person#Alice> <http://example.com/resource/person#friend_of> <http://example.com/resource/person#Bill> . <http://example.com/resource/person#Alice> <http://example.com/resource/person#resident_of> <http://example.com/resource/person#Austin>. <http://example.com/resource/car#Tesla> <http://example.com/car#color> “blue” .
  • 14. SPARQL PREFIX abbreviation BEFORE: <http://example.com/resource/person#Alice> <http://example.com/resource/person#drives> <http://example.com/resource/car#Tesla <http://example.com/resource/person#Alice> <http://example.com/resource/person#friend_of> <http://example.com/resource/person <http://example.com/resource/person#Alice> <http://example.com/resource/person#resident_of> <http://example.com/resource#Aus <http://example.com/resource#Tesla> <http://example.com/resource#color> “blue” . With PREFIX we can get a much shorter representation with abbreviations. AFTER: PREFIX tslap: <http://example.com/resource/person#> . PREFIX tslar: <http://example.com/resource#> . tslap:Alice tslap:drives tslac:Tesla . tslap:Alice tslap:friend_of tslap:Bill . tslap:Alice tslap:resident_of tslar:Austin . tslar:Tesla tslar:color “blue”. <Alice> <drives> <Tesla> . <Alice> <friend_of> <Bill> . <Alice> <resident_of> <Austin>. <Tesla> <color> “blue” . Same as below without URIs, but now universally uniquely identified
  • 15. PREFIX Short For: rdf: http://xmlns.com/foaf/0.1/ rdfs: http://www.w3.org/2000/01/rdf-schema# owl: http://www.w3.org/2002/07/owl# xsd: http://www.w3.org/2001/XMLSchema# dc: http://purl.org/dc/elements/1.1/ foaf: http://xmlns.com/foaf/0.1/ Common Prefixes More common prefixes at http://prefix.cc
  • 16. SPARQL stands for: SPARQL Protocol And RDF Query Language A query language and a protocol What is SPARQL? A SPARQL QUERY: SELECT … FROM …. WHERE { … } GROUP BY … ORDER BY … SELECT – Identifies the values to return FROM – selects the dataset to query WHERE – the graph patterns to match GROUP BY – group aggregations on this field ORDER BY – order the result set
  • 17. INSERT DATA { GRAPH <test1> { <Alice> <drives> <Tesla> . <Alice> <friend_of> <Bill> . <Alice> <resident_of> <Austin>. <Tesla> <color> "blue" . } } Let’s INSERT some data
  • 18. SELECT (count(*) as ?count) FROM <test1> WHERE { ?s ?p ?o . } RESULT: count -------- 4 Let’s count how many triples are in the graph
  • 19. SELECT ?s ?p ?o FROM <test1> WHERE { ?s ?p ?o . } Show all the triples
  • 20. SELECT ?s FROM <test1> WHERE { ?s <drives> <Tesla> . } RESULT: s ------- Alice 1 rows Use graph patterns to find data you want Who drives a Tesla?
  • 21. SELECT ?s FROM <test1> WHERE { ?s <drives> ?car . ?car <color> "blue" . } Who drives a blue car? Join operation Use graph patterns to match data in the graph
  • 22. Who drives a blue car? Join operation Use graph patterns to match data in the graph
  • 23. SELECT ?s ?color ?year FROM <test1> WHERE { ?s <drives> ?car . ?car <color> ?color . ?car <year> ?year . } RESULT? No results. Why? <year> does not exist in our graph Graph patterns must exist in the WHERE Who drives a car and what’s the color and year?
  • 24. SELECT ?s ?color ?year FROM <test1> WHERE { ?s <drives> ?car . ?car <color> ?color . OPTIONAL{?car <year> ?year . } } RESULT: s | color | year -------+-------+------ Alice | blue | 1 rows Who drives a blue car? USE OPTIONAL for Graph patterns that might not exist
  • 25. • ORDER BY: This modifier sorts the result set in a particular order. It sorts query solutions on the value of one or more variables. • OFFSET: Using this modifier in conjunction with LIMIT and ORDER BY returns a slice of a sorted solution set, for example, for paging. • LIMIT: This modifier restricts the results to return a certain number of solutions. • GROUP BY: This modifier is used with aggregate functions and specifies the key variables to use to partition the solutions into groups. For information about AnzoGraph GROUP BY clause extensions, see Advanced Grouping Sets. • HAVING: This modifier is used with aggregate functions and further filters the results after applying the aggregates. SPARQL SELECT, like SQL, has several solution modifiers
  • 26. The built-in SPARQL aggregate functions: AVG: Calculates the average value for a numeric expression. COUNT: Counts the number of times the specified value is bound to the given variable. GROUP_CONCAT: Performs a string concatenation of all of the values that are bound to the given variable. MAX: Returns the maximum value from the specified set of values. MIN: Returns the minimum value from the specified set of values. SAMPLE: Returns an arbitrary value from the specified set of values. SUM: Adds the specified values. Aggregate Functions
  • 27. There are Four standard SPARQL query forms: SELECT: Run SELECT queries when you want to find and return all of the data that matches certain patterns. CONSTRUCT: Run CONSTRUCT queries when you want to create or transform data based on the existing data. ASK: Run ASK queries when you want to know whether a certain pattern exists in the data. ASK queries return only "true" or "false" to indicate whether a solution exists. DESCRIBE: Run DESCRIBE queries when you want to view the RDF graph that describes a particular resource. Query Forms
  • 29. ©Cambridge Semantics Inc. Company Confidential info.anzograph@CambridgeSemantics.com www.anzograph.com AnzoGraph.com