cooljohny
cooljohny

Reputation: 706

full text search in jena sparql?

I am new to sparql and I am trying to search a word in one of the property . The simple queries works fine but I don't know how to perform full text search . I saw this example on jena website :

    PREFIX text: <http://jena.apache.org/text#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?s
{ ?s text:query (rdfs:label 'word' 10) ; 
     rdfs:label ?label 
}

my model contains property named SUB: and I want to write a query for that . I don't understand what is text and query in text:query means in the above example . Pardon me if this question doesn't meet the requirements of SO. Link to website:http://jena.apache.org/documentation/query/text-query.html

Upvotes: 2

Views: 1080

Answers (1)

AndyS
AndyS

Reputation: 16700

You may not need a full text index:

SELECT ?s
{ ?s your:property ?o .
  FILTER regex(str(?o), "word", "i")
}

but if you do text:query is a "property function" -- it trigger accessing the Apache Lucene index and causing ?s to be bound to each of the answers from a match of 'word' (to a limit of 10) over the rdfs:label properties if you have correctly configured and loaded the data and index.

Upvotes: 1

Related Questions