PREFIX Clause
The PREFIX clause declares any abbreviations for URIs that you want to reference in a query. You can declare prefixes to simplify query text if your data includes long URI names. If you do not declare prefixes, you must include the full URI names in the query.
Tip: Rather than declaring prefixes in all queries and load files, you can define common prefixes in a standard prefix file. AnzoGraph automatically recognizes these prefixes in all load files and queries. See Defining Standard Prefixes for more information.
Syntax
PREFIX uri_abbreviation: <uri_to_substitute_for_abbreviation> [ PREFIX uri_abbreviation: <uri_to_substitute_for_abbreviation> ] [ ... ]
URIs can be well-formed and absolute, such as <http://www.w3.org/1999/02/22-rdf-syntax-ns>
or relative, such as <http://cambridgesemantics.com/property#>
or <tickit/sales/>
.
AnzoGraph places no restrictions on URIs. The only requirement for writing a URI is that you place the text between < > characters, for example, <sales>.
Examples
The following example query declares a prefix and then uses the declared URI abbreviation in place of full the URI names in the query.
PREFIX t: <http://cambridgesemantics.com/graphs/tickit#> SELECT ?eventname ?location FROM <http://cambridgesemantics.com/graphs/tickit> WHERE { ?eventid t:venueid ?venueid . ?venueid t:venuename ?location . ?eventid t:dateid ?dateid . ?eventid t:eventname ?eventname . } ORDER BY ?location