Menu

Home

turnguard

Welcome 2 Tuqs

Tuqs is a OpenRDF SAIL API implementation based on Lucene. It uses sophisticated QueryEvaluation improvements to gain speed where possible.
One of these advantages is the use of union-uris as subjects and predicates and union-values as objects where possible.
The other big performance boost is achieved by making openRDF's QueryEvaluationStrategy ast-tree-stepping multithreaded. Normal openrdf QueryEvaluation first retrieves all prefLabels, matches them and then gets
the narrowers of the result sequentially. with tuqs exactly this step is
done in parallel according do the number of processors. check out the resulting ast-tree of the below query

PREFIX tg:<http://schema.turnguard.com/tuqs/1.1/function#> 
SELECT ?s ?n
  WHERE { 
    ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?o   
    FILTER(reqex(str(?o,'semantic','i'))). 
    ?s <http://www.w3.org/2004/02/skos/core#narrower> ?n
  }

Being base on Lucene it is possible to use the whole set of Lucene's QuerySyntax in SPARQL queries.
Please note that this version is based on OpenRDF 2.6.1 and Lucene 3.5 meaning that also aggregate function can be used.

tg:fts can be used to issue a fulltext query :

PREFIX tg:<http://schema.turnguard.com/tuqs/1.1/function#>
SELECT ?s ?label (SUM(?score) AS ?score) 
  WHERE { 
    ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?o   
    FILTER(tg:fts(?o,'Semantic*','en')). 
    ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?label 
  } 
GROUP BY ?s ?label ORDER BY DESC(?score)

please note that the above example also shows one more thing :

the score is retrievable by simply using "score" as a binding.
in case of GROUP BY queries the score of each triple is summed up.

an example for the optimization of the queryEvaluation

PREFIX tg:<http://schema.turnguard.com/tuqs/1.1/function#> 
SELECT ?s ?o (SUM(?score) AS ?score) 
  WHERE { 
    { 
      ?s <http://www.w3.org/2004/02/skos/core#prefLabel> ?o 
    } UNION { 
      ?s <http://www.w3.org/2004/02/skos/core#altLabel> ?o 
    } 
    FILTER(tg:fts(?o,'Semantic*','en')). 
  } 
  GROUP BY ?s ?o ORDER BY DESC(?score)

in the above case the two statement expressions that come from parsing the query to an ast tree are combined into one statement retrieval using
a TuqsUnionPredicate as the predicate of the statement to be retrieved.

what is to be expected next?

  1. since the whole lucene api is at hand an entity extractor is about to be developed in the depths of turnguard's labs. it will be possible to do entity extraction in a SPARQL query or via API making use of the Tuqs index.
  2. more language related magic predicates, for example exposing the termFrequency and the like via SPARQL.

further information follows soon.

for information and special interest request, feel free to contact me
tschyrgie@yahoo.com
+436766212710

wkr http://www.turnguard.com/turnguard


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.