RDF query language
{{short description|Resource Description Framework query language, a W3C recommendation}}
An RDF query language is a computer language, specifically a query language for databases, able to retrieve and manipulate data stored in Resource Description Framework (RDF) format.
SPARQL has emerged as the standard RDF query language,{{cite book|last1=Bikakis|first1=Nikos|last2=Tsinaraki|first2=Chrisa|last3=Gioldasis|first3=Nektarios|last4=Stavrakantonakis|first4=Ioannis|last5=Christodoulakis|first5=Stavros|title=Semantic Hyper/Multimedia Adaptation |chapter=The XML and Semantic Web Worlds: Technologies, Interoperability and Integration: A Survey of the State of the Art |volume=418|date=1 January 2013|pages=319–360|doi=10.1007/978-3-642-28977-4_12|language=en|arxiv=1608.03556|series=Studies in Computational Intelligence|isbn=978-3-642-28976-7|s2cid=6357481}} and in 2008 became a W3C recommendation.{{cite web |url=http://www.w3.org/TR/rdf-sparql-query/ |title=SPARQL Query Language for RDF |last1=Prud'hommeaux |first1=Eric |last2=Seaborne |first2=Andy |date=15 January 2008 |work=W3C |publisher=World Wide Web Consortium}}{{cite web |url=http://www.w3.org/blog/SW/2008/01/15/sparql_is_a_recommendation |title=SPARQL is a Recommendation |last=Herman |first=Ivan |date=15 January 2008 |work=Semantic Web Activity News |publisher=World Wide Web Consortium}}
Query language properties
Properties relevant to RDF query language design include support for the RDF format:{{cite book|last1=Haase|first1=Peter|last2=Broekstra|first2=Jeen|last3=Eberhart|first3=Andreas|last4=Volz|first4=Raphael|title=The Semantic Web – ISWC 2004 |chapter=A Comparison of RDF Query Languages |volume=3298|date=7 November 2004|pages=[https://archive.org/details/semanticwebiswc20000inte/page/502 502–517]|doi=10.1007/978-3-540-30475-3_35|language=en|series=Lecture Notes in Computer Science|isbn=978-3-540-23798-3|citeseerx=10.1.1.105.8731|chapter-url=https://archive.org/details/semanticwebiswc20000inte/page/502}}
- Support for RDF data, which is a collection of triples that form the RDF graph
- Support for RDF semantics and inference that allows for entailment, the reasoning about the meaning of RDF graphs
- Support for schema data types, such as XML schema
and for desirable language features:
- Expressiveness: the power of query expression that may be constructed
- Closure: data operations on an RDF graph should result in another RDF graph
- Orthogonality: data operations are independent of the context in which they are used
- Safety: every expression returns a finite set of results.
Query language families
RDF query languages can be grouped into language families, each family comprising a set of closely related languages.{{cite book|last1=Bailey|first1=James|last2=Bry|first2=François|last3=Furche|first3=Tim|last4=Schaffert|first4=Sebastian|title=Reasoning Web |chapter=Web and Semantic Web Query Languages: A Survey |series=Lecture Notes in Computer Science |journal=Proceedings of the First International Conference on Reasoning Web|date=1 January 2005|volume=3564 |pages=35–133|doi=10.1007/11526988_3|url=http://dl.acm.org/citation.cfm?id=2156064|access-date=23 October 2016|isbn=9783540278283}}
The SPARQL family of languages includes SquishQL, RDQL, SPARQL, and TriQL. These languages treat RDF data stores as triple stores that do not necessarily have ontology or schema information associated with them. Members of the SPARQL family are considered relational query languages because they have relational or pattern-based operations.{{cite book|last1=Furche|first1=Tim|last2=Linse|first2=Benedikt|last3=Bry|first3=François|last4=Plexousakis|first4=Dimitris|last5=Gottlob|first5=Georg|title=Reasoning Web |chapter=RDF Querying: Language Constructs and Evaluation Methods Compared |volume=4126|date=1 January 2006|pages=1–52|doi=10.1007/11837787_1|language=en|series=Lecture Notes in Computer Science|isbn=978-3-540-38409-0|citeseerx=10.1.1.71.227}} SquishQL was a language constructed to be easy to use and similar in structure to SQL. RDQL, an acronym for RDF Data Query Language, was a further development of SquishQL. RDQL was intended to be a simple low level RDF language and was at one point a candidate for W3C standardization.{{cite web|title=RDQL - A Query Language for RDF|url=https://www.w3.org/Submission/RDQL/|website=www.w3.org|publisher=W3C|access-date=23 October 2016}} SPARQL is an extension of RDQL that supports extraction of RDF subgraphs. In 2008, SPARQL 1.0 became a W3C recommendation{{cite web|title=SPARQL is a Recommendation {{!}} Semantic Web Activity News|url=https://www.w3.org/blog/SW/2008/01/15/sparql_is_a_recommendation/|website=www.w3.org|date=15 January 2008 |access-date=23 October 2016}} and SPARQL 1.1 became a W3C recommendation in 2013.{{cite web|title=Eleven SPARQL 1.1 Specifications are W3C Recommendations {{!}} Semantic Web Activity News|url=https://www.w3.org/blog/SW/2013/03/21/eleven-sparql-1-1-specifications-are-w3c-recommendations/|website=www.w3.org|date=21 March 2013 |access-date=23 October 2016}}
The RQL family of languages includes RQL, SeRQL, and eRQL. These languages support querying of both data and schema. RQL, an acronym for RDF Query Language, is known for using types defined in RDF schemas (RDFS) to query the schema class hierarchy and to support data querying by type. RQL is considered more expressive than the SPARQL family of languages, but has been criticized for too many features and unusual syntactic constructs. SeRQL and eRQL were developed as simplified alternatives to RQL.
There is a family of RDF query languages inspired by XML query technology. XQuery for RDF uses the XML query language XQuery to query RDF data by serializing RDF into an XML format and then using XQuery on the result; this has been called the "syntactic web approach". TreeHugger and RDF Twig use XSLT to query RDF data. Versa by 4Suite is a query language that drew inspiration from XPath.
There exist RDF query languages based on other principles. Metalog combines querying with reasoning and has an English like syntax. Algae is a query language developed by the W3C that adds reactive rules,{{cite book|last1=Berstel|first1=Bruno|last2=Bonnard|first2=Philippe|last3=Bry|first3=François|last4=Eckert|first4=Michael|last5=Pătrânjan|first5=Paula-Lavinia|title=Reasoning Web |chapter=Reactive Rules on the Web |volume=4636|date=1 January 2007|pages=[https://archive.org/details/reasoningwebthir0000summ/page/183 183–239]|doi=10.1007/978-3-540-74615-7_3|language=en|series=Lecture Notes in Computer Science|isbn=978-3-540-74613-3|chapter-url=https://archive.org/details/reasoningwebthir0000summ/page/183}} also called actions, that determine for instance whether an Algae expression is a data query or a data update.
Other examples of RDF Query languages include RDFDBQL.{{cite book|first1=Dieter|last1=Fensel|first2=Katia|last2=Sycara|first3=John|last3=Mylopoulus|title=The Semantic Web - ISWC 2003|publisher=Springer|year=2003|url=https://books.google.com/books?id=BDdtZKziytgC |access-date=21 October 2016|page=89 |isbn=9783540203629}}
Example
select
?uri,?name, ?lat, ?lon
from
where
(?city,
(?city,
(?city,
(?city,
using
rdfs FOR
pos FOR
doilair FOR
vcard FOR
Related languages
Other languages which can query RDF data include:
- DQL, XML-based, queries and results expressed in DAML+OIL
- XUL has a [https://developer.mozilla.org/en/docs/XUL:Template_Guide:Introduction template] element in which to declare rules for matching data in RDF. XUL uses RDF extensively for databinding.
- Adenine (programming language written in RDF).
XQuery, or XML Query, is a standard query language for XML documents.{{cite web|title=XQuery 3.0: An XML Query Language|url=https://www.w3.org/TR/xquery-30/|website=www.w3.org|publisher=W3C|access-date=23 October 2016}}
Graph query languages, such as Cypher Query Language, GraphQL, and Gremlin, are designed to query graph databases, of which RDF data stores are an example.{{cite book|last1=Angles|first1=Renzo|last2=Gutierrez|first2=Claudio|title=The Semantic Web: Research and Applications |chapter=Querying RDF Data from a Graph Database Perspective |volume=3532|date=29 May 2005|pages=346–360|doi=10.1007/11431053_24|language=en|series=Lecture Notes in Computer Science|isbn=978-3-540-26124-7}}
The Topic Map Query Language (TMQL){{cite web|title=Topic Map Query Language (TMQL)|url=http://www.isotopicmaps.org/tmql/|website=www.isotopicmaps.org|access-date=23 October 2016}} is a query language for topic maps, a data representation similar to but more general than RDF.
References
{{Reflist}}
External links
- [http://www.w3.org/TandS/QL/QL98/pp/rdfquery.html RDF Query specification]
- [http://www.w3.org/2001/11/13-RDF-Query-Rules/ RDF query language survey]
- [https://web.archive.org/web/20080702143156/http://www.aifb.uni-karlsruhe.de/WBS/pha/rdf-query/ A Comparison of (some) RDF Query Languages]
- [http://rdfstore.sourceforge.net/2002/06/24/rdf-query/ RDF query use cases, including query language samples]
- [http://www.w3.org/TR/rdf-sparql-query/ SparQL]
{{Query languages}}