Queries

Created on Feb. 23, 2013, 11:45 a.m. by Hevok & updated by Hevok on May 2, 2013, 5:19 p.m.

SPARQL is not only a simple Query Language one has more possibilities that just simple use the SELECT Statement.

Besides the SELECT Statement SPARQL allows some more general form of questioning such as the ASK Query. In an ASK Query one simple asks does some results exists from the Query Expression and checks whether there is at least one result and the result will be either True or False. If the result of an ASK Query is True this means there are some results and at leas there is one result. One does this if one does not need the Content of the result and one only needs the Information if there is a result or no result possible and then it is much faster. The result will be delivered as XML or also as JSON. Therefore one has always the possibility that the result should be parsed as a JSON file.

Secondly, one has also the possibility to construct an RDF Graph from the results that are delivered from the SPARQL Endpoint. So one does this with the SPARQL CONSTRUCT keyword. The Graph Patterns with Variables are according to a given Template will be the Output in e.g. RDF/XML or Turtle (can be specified).

The Third Variant is a DESCRIBE Statement that also takes a SPARQL Query and the result will be an entire RDF Graph with data about the Resources against one Queries. So this will be much more complete information in also RDF/XML or Turtle. * In addition to SELECT Queries SPARQL allows: - ASK + Check whether there is at least one result + Result: True or False + Result is deliver as XML or JSON - CONSTRUCT + Result: and RDF Graph constructed from a Template + Template: Graph Pattern with Variables from the Query Pattern + Result is RDF/XML or Turtle - DESCRIBE + Result: an RDF Graph with Data about Resources + Result is RDF/XML or Turtle

queries.jpg

Tags: query, information, database
Categories: Tutorial
Parent: SPARQL

Update entry (Admin) | See changes

Comment on This Data Unit


Please log in for making a comment without the need to specify any credentials.