RDF query language
Query language properties
Properties relevant to RDF query language design include support for the RDF format:
- 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.
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. 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. SPARQL is an extension of RDQL that supports extraction of RDF subgraphs. In 2008, SPARQL 1.0 became a W3C recommendation and SPARQL 1.1 became a W3C recommendation in 2013.
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, also called actions, that determine for instance whether an Algae expression is a data query or a data update.
select ?uri,?name, ?lat, ?lon from <http://swordfish.rdfweb.org/discovery/2003/11/cities/xmlrdf.jsp?query=port> where (?city, <rdfs:label>, ?name), (?city, <rdfs:label>,?uri), (?city, <pos:lat>, ?lat), (?city, <pos:long>, ?lon) using rdfs FOR <http://www.w3.org/2000/01/rdf-schema#>, pos FOR <http://www.w3.org/2003/01/geo/wgs84_pos#>, doilair FOR <http://www.daml.org/2001/10/html/airport-ont#>, vcard FOR <http://www.w3.org/vcard-rdf/3.0#>
Other languages which can query RDF data include:
- DQL, XML-based, queries and results expressed in DAML+OIL
- XUL has a template element in which to declare rules for matching data in RDF. XUL uses RDF extensively for databinding.
- Adenine (programming language written in RDF).
- Bikakis, Nikos; Tsinaraki, Chrisa; Gioldasis, Nektarios; Stavrakantonakis, Ioannis; Christodoulakis, Stavros (1 January 2013). The XML and Semantic Web Worlds: Technologies, Interoperability and Integration: A Survey of the State of the Art. Semantic Hyper/Multimedia Adaptation. Studies in Computational Intelligence. 418. pp. 319–360. arXiv:1608.03556. doi:10.1007/978-3-642-28977-4_12. ISBN 978-3-642-28976-7.
- Prud'hommeaux, Eric; Seaborne, Andy (15 January 2008). "SPARQL Query Language for RDF". W3C. World Wide Web Consortium.
- Herman, Ivan (15 January 2008). "SPARQL is a Recommendation". Semantic Web Activity News. World Wide Web Consortium.
- Haase, Peter; Broekstra, Jeen; Eberhart, Andreas; Volz, Raphael (7 November 2004). A Comparison of RDF Query Languages. The Semantic Web – ISWC 2004. Lecture Notes in Computer Science. 3298. pp. 502–517. CiteSeerX 10.1.1.105.8731. doi:10.1007/978-3-540-30475-3_35. ISBN 978-3-540-23798-3.
- Bailey, James; Bry, François; Furche, Tim; Schaffert, Sebastian (1 January 2005). Web and Semantic Web Query Languages: A Survey. Proceedings of the First International Conference on Reasoning Web. pp. 35–133. doi:10.1007/11526988_3. ISBN 9783540278283. Retrieved 23 October 2016.
- Furche, Tim; Linse, Benedikt; Bry, François; Plexousakis, Dimitris; Gottlob, Georg (1 January 2006). RDF Querying: Language Constructs and Evaluation Methods Compared. Reasoning Web. Lecture Notes in Computer Science. 4126. pp. 1–52. CiteSeerX 10.1.1.71.227. doi:10.1007/11837787_1. ISBN 978-3-540-38409-0.
- "RDQL - A Query Language for RDF". www.w3.org. W3C. Retrieved 23 October 2016.
- "SPARQL is a Recommendation | Semantic Web Activity News". www.w3.org. Retrieved 23 October 2016.
- "Eleven SPARQL 1.1 Specifications are W3C Recommendations | Semantic Web Activity News". www.w3.org. Retrieved 23 October 2016.
- Berstel, Bruno; Bonnard, Philippe; Bry, François; Eckert, Michael; Pătrânjan, Paula-Lavinia (1 January 2007). Reactive Rules on the Web. Reasoning Web. Lecture Notes in Computer Science. 4636. pp. 183–239. doi:10.1007/978-3-540-74615-7_3. ISBN 978-3-540-74613-3.
- Fensel, Dieter; Sycara, Katia; Mylopoulus, John (2003). The Semantic Web - ISWC 2003. Springer. p. 89. ISBN 9783540203629. Retrieved 21 October 2016.
- "XQuery 3.0: An XML Query Language". www.w3.org. W3C. Retrieved 23 October 2016.
- Angles, Renzo; Gutierrez, Claudio (29 May 2005). Querying RDF Data from a Graph Database Perspective. The Semantic Web: Research and Applications. Lecture Notes in Computer Science. 3532. pp. 346–360. doi:10.1007/11431053_24. ISBN 978-3-540-26124-7.
- "Topic Map Query Language (TMQL)". www.isotopicmaps.org. Retrieved 23 October 2016.