- Artificial Intelligence for Big Data
- Anand Deshpande Manish Kumar
- 496字
- 2021-06-25 21:57:10
SPARQL query language
With a generic understanding of Ontologies, the RDF, and OWL, we are able to fundamentally understand how intelligent systems can communicate with each other seamlessly with a semantic view of the world. With a semantic worldview, the entities come to life by translating data assets into information and information assets into knowledge. It is imperative that there is a common language to leverage a semantic worldview so that heterogeneous systems can communicate with each other. SPARQL is a W3C standard that is attempting to be the global query language with the primary goal of interoperability. SPARQL is a recurring acronym and stands for SPARQL Protocol and RDF Query Language. As the name indicates, it is a query language for querying knowledge (as triples) stored in RDF format. Traditionally, we stored the information in relational databases in tabular format. The relational database view of the entities can easily be represented as triples. For example, let us once again consider the BOOK table:

Here, the row identifier (Book_ID and Title) is the subject, the column name is the predicate, and the column value is the object. For example:
A Triple:
{1: Hit Refresh} {Author} {Satya Nadella}
Subject (Entity Name) Predicate (Attribute Name) Object (Attribute Value)
The subjects and predicates are represented using URIs which universally identify specific subjects and predicates as resources:
http://www.artificial-intelligence.big-data/book# http://www.artificial-intelligence.big-data/book#author "Satya Nadella"
Turtle syntax allows an RDF graph to be completely written in a compact and natural text form. It provides abbreviations for common usage patterns and datatypes. This format is compatible with the triple pattern syntax of SPARQL.
Let us use the turtle syntax to represent the book table in RDF format:
@prefix book: <http://www.artificial-intelligence.big-data/book#>
book:1 book:Title "Hit Refresh"
book:1 book:Author "Satya Nadella"
book:1 book:Company "Microsoft"
book:1 book:Year "2017"
book:2 book:Title "Shoe Dog"
book:2 book:Author "Phil Knight"
book:2 book:Company "Nike"
book:2 book:Year "2016"
Let us use a simple SPARQL query for getting a list of books published in the year 2017:
PREFIX book: <http://www.artificial-intelligence.big-data/book#>
SELECT ?books
WHERE
{
?books book:year "2017" .
}
We have the following result:
?books
book:1
Here is another SELECT query, which fetches more data elements from the dataset:
PREFIX book: <http://www.artificial-intelligence.big-data/book#>
SELECT ?books ?bookName ?company
WHERE
{
?books book:year "2017" .
?books book:title ?bookName .
?books book:company ?company .
}
The result is as follows:
?books ?bookName ?company
book:1 Hit Refresh Microsoft
While we are discussing role of Ontologies in the context of Artificial Intelligence for Big Data, a complete reference to OWL and SPARQL is outside of the scope of this book. In the following subsections, we will introduce a generic SPARQL language reference, which will help us leverage Ontologies to build artificial intelligence.
- 數據分析實戰:基于EXCEL和SPSS系列工具的實踐
- 數據庫基礎與應用:Access 2010
- 大數據:從概念到運營
- Python數據分析:基于Plotly的動態可視化繪圖
- 區塊鏈:看得見的信任
- Proxmox VE超融合集群實踐真傳
- Instant Autodesk AutoCAD 2014 Customization with .NET
- 視覺大數據智能分析算法實戰
- Augmented Reality using Appcelerator Titanium Starter
- Python數據分析從小白到專家
- 信息融合中估計算法的性能評估
- 基于數據發布的隱私保護模型研究
- 掌中寶:電腦綜合應用技巧
- Redis 6開發與實戰
- 2D 計算機視覺:原理、算法及應用