filak commented on issue #2094: URL: https://github.com/apache/jena/issues/2094#issuecomment-1814654091
Yes, sure. I have been trying to use a default query using mt:defQuery - not searching in the note and multiple other fields and a second query mt:includeNotes - including the note field and possibly other fields. I have simplified my use case. Test data - drinks.nt ``` <http://id.example.test/1> <http://www.w3.org/2000/01/rdf-schema#label> "beer"@en . <http://id.example.test/1> <http://id.example.test/vocab/#altLabel> "pint"@en . <http://id.example.test/1> <http://id.example.test/vocab/#altLabel> "pivečko"@cs . <http://id.example.test/1> <http://id.example.test/vocab/#note> "Booze is a pleasure"@en . <http://id.example.test/1> <http://id.example.test/vocab/#note> "Chlast je slast"@cs . <http://id.example.test/2> <http://www.w3.org/2000/01/rdf-schema#label> "wine"@en . <http://id.example.test/2> <http://id.example.test/vocab/#altLabel> "champagne"@en . <http://id.example.test/2> <http://id.example.test/vocab/#altLabel> "víno"@en . <http://id.example.test/2> <http://id.example.test/vocab/#note> "Red or white"@en . <http://id.example.test/2> <http://id.example.test/vocab/#note> "Červené či bílé"@cs . ``` The config - drinks.ttl ``` @prefix : <http://localhost/jena_example/#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix tdb2: <http://jena.apache.org/2016/tdb#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . @prefix text: <http://jena.apache.org/text#> . @prefix fuseki: <http://jena.apache.org/fuseki#> . @prefix mt: <http://id.example.test/vocab/#> . ## Initialize text query [] ja:loadClass "org.apache.jena.query.text.TextQuery" . # A TextDataset is a regular dataset with a text index. text:TextDataset rdfs:subClassOf ja:RDFDataset . # Lucene index text:TextIndexLucene rdfs:subClassOf text:TextIndex . # Elasticsearch index text:TextIndexES rdfs:subClassOf text:TextIndex . ## --------------------------------------------------------------- ## This URI must be fixed - it's used to assemble the text dataset. :text_dataset a text:TextDataset ; text:dataset <#dataset> ; text:index <#indexLucene> ; . # A TDB dataset used for RDF storage <#dataset> a tdb2:DatasetTDB2 ; tdb2:location "d:/Data/jena/databases/drinks" ; . # Text index description <#indexLucene> a text:TextIndexLucene ; text:directory "d:/Data/jena/indexes/drinks" ; text:entityMap <#entMap> ; text:storeValues true ; text:analyzer [ a text:ConfigurableAnalyzer ; text:tokenizer text:StandardTokenizer ; text:filters (text:ASCIIFoldingFilter text:LowerCaseFilter) ] ; text:queryParser text:AnalyzingQueryParser ; text:multilingualSupport true ; text:propLists ( [ text:propListProp mt:defQuery ; text:props ( rdfs:label mt:altLabel ) ; ] [ text:propListProp mt:includeNotes ; text:props ( rdfs:label mt:altLabel mt:note ) ; ] ) ; . <#entMap> a text:EntityMap ; text:defaultField "ftext" ; text:entityField "uri" ; text:uidField "uid" ; text:langField "lang" ; text:graphField "graph" ; text:map ( [ text:field "ftext" ; text:predicate rdfs:label ] [ text:field "ftext" ; text:predicate mt:altLabel ] [ text:field "ftext" ; text:predicate mt:note ] ) . <#service_text_tdb> a fuseki:Service ; rdfs:label "Drinks TEST" ; fuseki:name "drinks" ; fuseki:serviceQuery "query" ; fuseki:serviceQuery "sparql" ; fuseki:serviceUpdate "update" ; fuseki:serviceUpload "upload" ; fuseki:serviceReadGraphStore "get" ; fuseki:serviceReadWriteGraphStore "data" ; fuseki:dataset :text_dataset ; . ``` Load to Jena tdb2_tdbloader --loc %FUSEKI_BASE%/databases/drinks _imports/drinks.nt Index java -cp %FUSEKI_HOME%/fuseki-server.jar jena.textindexer --desc=configuration/drinks.ttl The queries at http://localhost:3030/#/dataset/drinks/query ``` PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> PREFIX owl: <http://www.w3.org/2002/07/owl#> PREFIX text: <http://jena.apache.org/text#> PREFIX mt: <http://id.example.test/vocab/#> select * where { ?s text:query ("beer white") } ``` => 2 hits - OK ``` select * where { ?s text:query (mt:includeNotes "white") } ``` => 1 hit - OK ``` select * where { ?s text:query (mt:defQuery "white") } ``` => 1 hit - but should it not be 0 because the "white" string is only in the note field ? I need to investigate further why my original queries with mt:props all return 0 though... -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
