Hi Jérôme Jérôme wrote: > Hi, > > Has somebody already tested to make LARQ queries on a Fuseki server with > the last > larq version (0.2.2-incubating-SNAPSHOT, ARQ: 2.8.9-incubating-SNAPSHOT, > Fuseki: 0.2.1-SNAPSHOT)
I've just updated the patch available here to include LARQ in the Fuseki distribution: https://issues.apache.org/jira/browse/JENA-63 Here is what I do to checkout, patch and compile/package Fuseki: cd /tmp svn co https://svn.apache.org/repos/asf/incubator/jena/Jena2/Fuseki/trunk/ fuseki cd /tmp/fuseki wget https://issues.apache.org/jira/secure/attachment/12498659/JENA-63_Fuseki_r1176980.patch patch -p0 < JENA-63_Fuseki_r1176980.patch mvn clean package I load some data with TDB: tdbloader --loc=/tmp/tdb books.ttl I ensure /tmp/lucene does not exists: rm -rf /tmp/lucene I start Fuseki: fuseki-server --config=config.ttl Here is my config.ttl: ------ @prefix : <#> . @prefix fuseki: <http://jena.apache.org/fuseki#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> . @prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> . [] rdf:type fuseki:Server ; fuseki:services ( <#service3> ) . [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . tdb:GraphTDB rdfs:subClassOf ja:Model . <#service3> rdf:type fuseki:Service ; fuseki:name "tdb" ; # http://host/tdb fuseki:serviceQuery "query" ; # SPARQL query service fuseki:dataset <#dataset> ; . <#dataset> rdf:type tdb:DatasetTDB ; tdb:location "/tmp/tdb" ; ja:textIndex "/tmp/lucene" ; # Query timeout on this dataset (milliseconds) ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ; ## tdb:unionDefaultGraph true ; . ------ I then query with: s-query --service=http://127.0.0.1:3030/tdb/query "PREFIX pf: <http://jena.hpl.hp.com/ARQ/property#> SELECT ?lit { ?lit pf:textMatch '+harry' }" Here is the result: ------ { "head": { "vars": [ "lit" ] } , "results": { "bindings": [ { "lit": { "type": "literal" , "value": "Harry Potter and the Philosopher's Stone" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Chamber of Secrets" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Prisoner Of Azkaban" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Goblet of Fire" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Order of the Phoenix" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Deathly Hallows" } } , { "lit": { "type": "literal" , "value": "Harry Potter and the Half-Blood Prince" } } ] } } ------ To help you solve your problem, here is the mvn dependency:tree I have: [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Building Fuseki [INFO] task-segment: [dependency:tree] [INFO] ------------------------------------------------------------------------ [INFO] [dependency:tree {execution: default-cli}] [INFO] org.openjena:fuseki:jar:0.2.1-SNAPSHOT [INFO] +- org.apache.jena:jena-arq:jar:2.8.9-incubating-SNAPSHOT:compile [INFO] | +- org.codehaus.woodstox:wstx-asl:jar:3.2.9:compile [INFO] | | \- stax:stax-api:jar:1.0.1:compile [INFO] | +- org.apache.httpcomponents:httpcore:jar:4.1.2:compile [INFO] | +- com.hp.hpl.jena:iri:jar:0.8:compile [INFO] | +- com.ibm.icu:icu4j:jar:3.4.4:compile [INFO] | \- xerces:xercesImpl:jar:2.7.1:compile [INFO] +- org.apache.jena:jena-larq:jar:0.2.2-incubating-SNAPSHOT:compile [INFO] | \- org.apache.lucene:lucene-core:jar:3.1.0:compile [INFO] +- org.apache.jena:jena-arq:jar:tests:2.8.9-incubating-SNAPSHOT:test [INFO] +- com.hp.hpl.jena:jena:jar:2.6.4:compile [INFO] +- com.hp.hpl.jena:jena:jar:tests:2.6.4:test [INFO] +- org.apache.jena:jena-tdb:jar:0.9.0-incubating-SNAPSHOT:compile [INFO] +- junit:junit:jar:4.8.2:compile [INFO] +- org.apache.httpcomponents:httpclient:jar:4.1.2:compile [INFO] +- commons-fileupload:commons-fileupload:jar:1.2.2:compile [INFO] +- commons-codec:commons-codec:jar:1.5:compile [INFO] +- org.eclipse.jetty:jetty-server:jar:7.2.1.v20101111:compile [INFO] | +- javax.servlet:servlet-api:jar:2.5:compile [INFO] | +- org.eclipse.jetty:jetty-continuation:jar:7.2.1.v20101111:compile [INFO] | \- org.eclipse.jetty:jetty-http:jar:7.2.1.v20101111:compile [INFO] | \- org.eclipse.jetty:jetty-io:jar:7.2.1.v20101111:compile [INFO] +- org.eclipse.jetty:jetty-servlet:jar:7.2.1.v20101111:compile [INFO] | \- org.eclipse.jetty:jetty-security:jar:7.2.1.v20101111:compile [INFO] +- org.eclipse.jetty:jetty-jsp-2.1:jar:7.2.1.v20101111:compile [INFO] +- org.mortbay.jetty:jsp-2.1-glassfish:jar:2.1.v20100127:compile [INFO] | +- org.eclipse.jdt.core.compiler:ecj:jar:3.5.1:compile [INFO] | +- org.mortbay.jetty:jsp-api-2.1-glassfish:jar:2.1.v20100127:compile [INFO] | \- ant:ant:jar:1.6.5:compile [INFO] +- org.eclipse.jetty:jetty-webapp:jar:7.2.1.v20101111:compile [INFO] | \- org.eclipse.jetty:jetty-xml:jar:7.2.1.v20101111:compile [INFO] | \- org.eclipse.jetty:jetty-util:jar:7.2.1.v20101111:compile [INFO] +- org.slf4j:slf4j-api:jar:1.6.1:compile [INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.1:compile [INFO] +- org.slf4j:jcl-over-slf4j:jar:1.6.1:compile [INFO] \- log4j:log4j:jar:1.2.16:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESSFUL [INFO] ------------------------------------------------------------------------ [INFO] Total time: 2 seconds [INFO] Finished at: Tue Oct 11 21:43:18 BST 2011 [INFO] Final Memory: 23M/347M [INFO] ------------------------------------------------------------------------ I really hope this help you to find what's wrong with your situation. Paolo > > I get this error message (I thought I had solved...): > > 14:15:56 WARN Fuseki :: [1] RC = 500 : > com.hp.hpl.jena.sparql.engine.binding.BindingMap > 14:15:56 INFO Fuseki :: [1] 500 > com.hp.hpl.jena.sparql.engine.binding.BindingMap > > May be i had not this message when queries returned no results.... > > > Jérôme > > > Le 11/10/11 12:21, Paolo Castagna a écrit : > > >> Jérôme wrote: >>> Le 11/10/11 11:36, Paolo Castagna a écrit : >>>> Jérôme wrote: >>>>> Le 11/10/11 11:14, Paolo Castagna a écrit : >>>>>> Jérôme wrote: >>>>>>> Le 11/10/11 10:08, Andy Seaborne a écrit : >>>>>>>> Jérôme, >>>>>>>> >>>>>>>> Sorry if you've said this before in previous emails but what's the >>>>>>>> query and what's the data like? When did you last update LARQ? >>>>>>> Hi Andy, >>>>>>> >>>>>>> I did my last LARQ update 2 days ago. The problem is not about >>>>>>> datas, >>>>>>> because the result is the same with the books.ttl file: 0 result >>>>>>> with a >>>>>>> very simple query like: >>>>>>> >>>>>>> PREFIX pf:<http://jena.hpl.hp.com/ARQ/property#> >>>>>>> SELECT ?doc >>>>>>> { >>>>>>> ?lit pf:textMatch 'Potter' . >>>>>>> ?doc ?p ?lit >>>>>>> } >>>>>>>> I'm trying to find out if something in the chain of packages has >>>>>>>> changed and whether we've introduced a a regression in ARQ or LARQ. >>>>>>>> >>>>>>>> The only ARQ change I can think of relates to named graphs but >>>>>>>> you're >>>>>>>> not using named graphs and the change to correctly handle property >>>>>>>> functions would only go from 0 to some results. >>>>>>>> >>>>>>>> You have the same data available via<#books> and >>>>>>>> via<#dataset> -- >>>>>>>> does the query work one route and not the other or are both now >>>>>>>> showing 0 results? >>>>>>> No, simple SPARQL queries works fine. I only have problem on the >>>>>>> lucene >>>>>>> indexed datas with LARQ queries. >>>>>> The problem is that somehow your Lucene index is empty or non >>>>>> existing. >>>>>> >>>>>> If the /tmp/lucene directory exists and it's empty or it contains an >>>>>> empty Lucene index when you start Fuseki. LARQ will *not* index your >>>>>> data. >>>>>> >>>>>> LARQ will index your data if and only if you point it at a non >>>>>> existing >>>>>> directory. When you start Fuseki, LARQ should create the /tmp/lucene >>>>>> directory for you and index your data. >>>>>> >>>>>> When I need to debug problems involving Lucene indexes I use: >>>>>> http://www.getopt.org/luke/luke-0.9.9/lukemin-0.9.9.jar >>>>>> ... it's very useful to inspect a Lucene index. I suspect yours is >>>>>> empty or non-existing. >>>>>> >>>>>> You can also try to use larq.larqbuilder to build your Lucene index >>>>>> manually at the beginning, but it would be much better if LARQ does >>>>>> automatically this for you (as it should be). Try this: >>>>>> >>>>>> 1. make sure Fuseki or your app is not running >>>>>> 2. java -cp fuseki-0.2.1-SNAPSHOT-sys.jar larq.larqbuilder \ >>>>>> --allow-duplicates --larq=/tmp/lucene \ >>>>>> --desc=/path/to/your/fuseki/config.ttl >>>>>> (one line!) >>>>>> 3. check your Lucene index in the /tmp/lucene directory >>>>>> 4. start Fuseki as usual >>>>> The larqbuilder command-line failed: >>>>> java -cp target/fuseki-0.2.1-SNAPSHOT-sys.jar larq.larqbuilder >>>>> --allow-duplicates --larq=/tmp/lucene --desc=config.ttl >>>>> com.hp.hpl.jena.sparql.ARQException: More than one: var ?root >>>>> at >>>>> com.hp.hpl.jena.sparql.util.QueryExecUtils.getOne(QueryExecUtils.java:354) >>>>> >>>>> >>>>> at >>>>> com.hp.hpl.jena.sparql.util.graph.GraphUtils.findRootByType(GraphUtils.java:191) >>>>> >>>>> >>>>> >>>>> at >>>>> com.hp.hpl.jena.sparql.core.assembler.AssemblerUtils.build(AssemblerUtils.java:97) >>>>> >>>>> >>>>> >>>>> at arq.cmdline.ModAssembler.create(ModAssembler.java:67) >>>>> at >>>>> arq.cmdline.ModDatasetAssembler.createDataset(ModDatasetAssembler.java:43) >>>>> >>>>> >>>>> at arq.cmdline.ModDataset.getDataset(ModDataset.java:34) >>>>> at larq.larqbuilder.exec(larqbuilder.java:84) >>>>> at arq.cmdline.CmdMain.mainMethod(CmdMain.java:97) >>>>> at arq.cmdline.CmdMain.mainRun(CmdMain.java:59) >>>>> at arq.cmdline.CmdMain.mainRun(CmdMain.java:46) >>>>> at larq.larqbuilder.main(larqbuilder.java:50) >>>> Ok, this is because larq.larqbuilder command does not support multiple >>>> datasets >>>> (as they have been introduced only recently in Fuseki's config format). >>>> >>>> Could you try to remove this from your config.ttl: >>>> >>>> <#books> rdf:type ja:RDFDataset ; >>>> rdfs:label "Books" ; >>>> ja:defaultGraph >>>> [ rdfs:label "discours_de_la_methode.rdf" ; >>>> a ja:MemoryModel ; >>>> ja:content [ja:externalContent<file:Data/file.rdf> ] ; >>>> ] ; >>>> . >>>> >>>> And, make sure you have only one dataset (i.e.<#dataset> rdf:type >>>> tdb:DatasetTDB)? >>>> >>>> Try again: >>>> >>>> 1. make sure Fuseki or your app is not running >>>> 2. rm -rf /tmp/lucene >>>> 3. java -cp fuseki-0.2.1-SNAPSHOT-sys.jar larq.larqbuilder \ >>>> --allow-duplicates --larq=/tmp/lucene \ >>>> --desc=/path/to/your/fuseki/config.ttl >>>> (one line!) >>>> 4. check your Lucene index in the /tmp/lucene directory >>>> 5. start Fuseki as usual >>> I think it's really better: my /tmp/lucene contains files. One new >>> problem...(sorry...), >>> I'm not able to test it because before running all my application, i've >>> tried a mvn install of LARQ (to compile and install my own changes) - i >>> get a dependency error: >>> Failed to execute goal on project jena-larq: Could not resolve >>> dependencies for project >>> org.apache.jena:jena-larq:jar:0.2.2-incubating-SNAPSHOT: Could not find >>> artifact org.apache.jena:jena-tdb:jar:0.8.11-SNAPSHOT in >>> apache.snapshots (http://repository.apache.org/snapshots) >>> >>> What are goupId and artefactId for TDB? Have they changed...? >> Hi Jérôme, >> you can browse any Maven repository, to check what are the SNAPSHOTs >> available: >> https://repository.apache.org/content/groups/snapshots/org/apache/jena/jena-tdb/ >> >> >> If you do that, you'll see that the version you need to use now is: >> 0.9.0-incubating-SNAPSHOT >> >> In general, the first thing I do when Maven fail to retrieve a >> dependency is >> to double check manually with a browser if the artifact is actually >> there. >> Most of the time, the problem is because I have an error or a typo in >> my pom.xml >> file. Check groupId, check artifactId, check version. This is what I do. >> >> Hopefully, we are getting there! >> >> Paolo >> >>>> larq.larqbuilder source code is here: >>>> https://svn.apache.org/repos/asf/incubator/jena/Jena2/LARQ/trunk/src/main/java/larq/larqbuilder.java >>>> >>>> >>>> >>>> Once again, ideas on how to improve it (and patches) are welcome! >>>> >>>> Paolo >>>> >>>>> The /tmp/lucene dir is created, with the empty write.lock file. >>>>> >>>>>> Does this work for you? >>>>>> >>>>>> Paolo >>>>>> >>>>>>> Jérôme >>>>>>>> Andy >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On 10/10/11 17:01, Paolo Castagna wrote: >>>>>>>>> Hi Jérôme, >>>>>>>>> first of all, thanks for helping out testing the LARQ >>>>>>>>> 0.2.2-incubating-SNAPSHOT >>>>>>>>> and for your patience. ;-) >>>>>>>>> >>>>>>>>> This hopefully will help to spot problems early one and reduce >>>>>>>>> problems once ARQ >>>>>>>>> and LARQ are released within Apache. >>>>>>>>> >>>>>>>>> Jérôme wrote: >>>>>>>>>> Hi, >>>>>>>>>> >>>>>>>>>> i've recently made an svn up on my LARQ directory. >>>>>>>>>> >>>>>>>>>> Now, my LARQ queries return 0 solution (they returned before). >>>>>>>>>> >>>>>>>>>> I'm using: >>>>>>>>>> - fuseki 0.2.1-SNAPSHOT >>>>>>>>>> -arq 2.8.9-SNAPSHOT >>>>>>>>>> -larq 0.2.2-incubating-SNAPSHOT >>>>>>>>> According to the LARQ's pom.xml file [1], LARQ >>>>>>>>> 0.2.2-incubating-SNAPSHOT now >>>>>>>>> depends on the new ARQ SNAPSHOTs. >>>>>>>>> Precisely, it depends on >>>>>>>>> org.apache.jena:jena-arq:2.8.9-incubating-SNAPSHOT >>>>>>>>> Please note the new groupId and artifactId for ARQ. >>>>>>>>> >>>>>>>>> New ARQ SNAPSHOTs are available here [2]. >>>>>>>>> >>>>>>>>> [1] >>>>>>>>> https://svn.apache.org/repos/asf/incubator/jena/Jena2/LARQ/trunk/pom.xml >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> [2] >>>>>>>>> https://repository.apache.org/content/repositories/snapshots/org/apache/jena/jena-arq/2.8.9-incubating-SNAPSHOT/ >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>>>> -lucene 3.1.0 >>>>>>>>>> >>>>>>>>>> My config.ttl file has not changed: >>>>>>>>>> >>>>>>>>>> [...] >>>>>>>>>> <#books> rdf:type ja:RDFDataset ; >>>>>>>>>> rdfs:label "Books" ; >>>>>>>>>> ja:defaultGraph >>>>>>>>>> [ rdfs:label "discours_de_la_methode.rdf" ; >>>>>>>>>> a ja:MemoryModel ; >>>>>>>>>> ja:content [ja:externalContent<file:Data/file.rdf> >>>>>>>>>> ] ; >>>>>>>>>> ] ; >>>>>>>>>> . >>>>>>>>>> >>>>>>>>>> <#dataset> rdf:type tdb:DatasetTDB ; >>>>>>>>>> tdb:location "/tmp/tdb" ; >>>>>>>>>> ja:textIndex "/tmp/lucene" ; >>>>>>>>>> # Query timeout on this dataset (milliseconds) >>>>>>>>>> ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue >>>>>>>>>> "1000" ] ; >>>>>>>>>> ## tdb:unionDefaultGraph true ; >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> Before running the fuseki server, i build my triple store with >>>>>>>>>> the >>>>>>>>>> command-line: >>>>>>>>>> java -cp target/fuseki-0.2.1-SNAPSHOT-sys.jar tdb.tdbloader >>>>>>>>>> --loc=/tmp/tdb Data/file.rdf >>>>>>>>> Can you please try: >>>>>>>>> >>>>>>>>> - stop Fuseki >>>>>>>>> - delete /tmp/lucence >>>>>>>>> - restart Fuseki >>>>>>>>> >>>>>>>>> LARQ will now behave like this: >>>>>>>>> >>>>>>>>> - if the directory exists with a Lucene index, it will >>>>>>>>> leave it >>>>>>>>> untouched >>>>>>>>> - if the directory does not exists it will create it and >>>>>>>>> index your >>>>>>>>> data >>>>>>>>> >>>>>>>>> What do you have in your /tmp/lucene directory? >>>>>>>>> >>>>>>>>>> So, i've no error - juste 0 result... >>>>>>>>>> >>>>>>>>>> Any ideas? >>>>>>>>>> >>>>>>>>>> Thank you. >>>>>>>>>> >>>>>>>>> Let us know how it goes, >>>>>>>>> Paolo >
