Skip to content

NTriple Query Parser

rdelbru edited this page Sep 7, 2011 · 6 revisions

N-Triple Query Parser

The N-Triple Query Parser has been made for the N-Triple indexing. N-Triple queries produce precise search results using simple, but powerful triple patterns to represent partial or complete triples. A “triple pattern” is a complete or partial representation of a triple s, p, o, where one can use the wildcard symbol "*" to substitute any part of the triple:

  • Find people called Renaud Delbru:
* <name> "Renaud Delbru"

Full-text search is supported on any part of the triple, which means that you can use the previously described 'Keyword Query' syntax to describe your subject, property or object. One should encompass the keyword query between '<' and '>' for URI patterns or between single quotes for literal patterns. The use of double quotes for a literal indicates a phrase query.

  • Find offers for iPods with boolean operators:
* <http://sindice.com/hlisting/0.1/itemName> 'ipod AND (nano OR shuffle)'

Triple patterns can be combined with boolean operators (AND, OR, NOT) and matching parentheses:

  • Find someone called "Giovanni Tummarello" ignoring the wording:
(
* <http://xmlns.com/foaf/0.1/givenname> "Giovanni" 
AND 
* <http://xmlns.com/foaf/0.1/family_name> "Tummarello"
) 
OR 
* <http://xmlns.com/foaf/0.1/name> "Giovanni Tummarello"