spaziocodice / SolRDF

An RDF plugin for Solr
Apache License 2.0
113 stars 20 forks source link

Error while programmatically loading ontologies #122

Closed hansidm closed 8 years ago

hansidm commented 8 years ago

I am getting the following stracktrace when trying to load some ontologies that locally stored on my machine programmatically using Jena:

org.apache.jena.riot.RiotException: Producer failed to ever call start(), declaring producer dead
    at org.apache.jena.riot.lang.PipedRDFIterator.hasNext(PipedRDFIterator.java:272)
    at org.gazzax.labs.solrdf.handler.update.RdfBulkUpdateRequestHandler$RdfDataLoader$2.load(RdfBulkUpdateRequestHandler.java:128)
    at org.gazzax.labs.solrdf.handler.update.RdfBulkUpdateRequestHandler$RdfDataLoader.load(RdfBulkUpdateRequestHandler.java:173)
    at org.apache.solr.handler.UpdateRequestHandler$1.load(UpdateRequestHandler.java:98)
    at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:74)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
    at org.gazzax.labs.solrdf.handler.Sparql11GraphStoreProtocolHandler.forward(Sparql11GraphStoreProtocolHandler.java:133)
    at org.gazzax.labs.solrdf.handler.Sparql11GraphStoreProtocolHandler.handleRequestBody(Sparql11GraphStoreProtocolHandler.java:77)
    at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:143)
    at org.apache.solr.core.SolrCore.execute(SolrCore.java:2068)
    at org.apache.solr.servlet.HttpSolrCall.execute(HttpSolrCall.java:672)
    at org.apache.solr.servlet.HttpSolrCall.call(HttpSolrCall.java:463)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:215)
    at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:179)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:577)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:215)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:110)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
    at org.eclipse.jetty.server.Server.handle(Server.java:499)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
    at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
    at java.lang.Thread.run(Thread.java:745)

And here it goes my code that tries to upload the ontologies:


Model model = ModelFactory.createDefaultModel();
DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(kbURL + Collections.METADATA_GRAPH);
model.read(filePath, getLang(contentType));
accessor.add(model);

And some of the ontologies I'm trying to load: http://hadatac.org/ont/hasneto# http://ecoinformatics.org/oboe/oboe.1.0/oboe-standards.owl# http://www.w3.org/ns/prov#

hansidm commented 8 years ago

Just to add, the error I get in Jena is 500 Server error.

hansidm commented 8 years ago

And the SolRDF used at the CreateHTTP method: http://127.0.0.1:8983/solr/store/rdf-graph-store

agazzarini commented 8 years ago

Hi @hansidm, that sounds really strange. The integration test suite is currently using the SolRDF Client API, which basically do the same. I've tried to run your code (using a different file, one of those used in the test suite) and everything works:

    public static void main(String[] args) throws Exception {
        Model model = ModelFactory.createDefaultModel();
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP("http://127.0.0.1:8080/solr/store/rdf-graph-store");
        model.read(new File("....").toURI().toString(), "N-TRIPLES");
        accessor.add(model);
    }

After that,

>  curl "http://127.0.0.1:8080/solr/store/solr-query?q=*:*&indent=true"
<?xml version="1.0" encoding="UTF-8"?>
<response>

<lst name="responseHeader">
  <int name="status">0</int>
  <int name="QTime">0</int>
</lst>
<result name="response" numFound="40" start="0">
  <doc>
    <str name="c">_</str>
    <str name="s">&lt;http://example.org/book2&gt;</str>
    <str name="p">&lt;http://example.org/ns#reviewed&gt;</str>
    <str name="id">c8ad7d73-970e-321f-9905-3030a6e9fa0c</str>
    <str name="o">"true"^^http://www.w3.org/2001/XMLSchema#boolean</str>
    <long name="_version_">1527433009339301888</long></doc>
  <doc>
    <str name="c">_</str>
    <str name="s">&lt;http://example.org/book2&gt;</str>
    <str name="p">&lt;http://example.org/ns#downloads&gt;</str>
    <str name="id">e7c6cffc-8640-3c09-9abe-c5567b61fe91</str>
    <str name="o">"442"^^http://www.w3.org/2001/XMLSchema#integer</str>
    <long name="_version_">1527433009388584960</long></doc>
  <doc>
    <str name="c">_</str>
    <str name="s">&lt;http://example.org/book2&gt;</str>
    <str name="p">&lt;http://example.org/ns#price&gt;</str>
    <str name="id">1d17d424-979f-36be-990f-a12d98f9eaf5</str>
    <str name="o">"23.95"^^http://www.w3.org/2001/XMLSchema#double</str>
    <long name="_version_">1527433009389633536</long></doc>
  <doc>
    <str name="c">_</str>
...

I suspect your (client) module is not filled. Check here


model.read(filePath, getLang(contentType));

It is not a path, that must be a valid URI (check my sample code above). I guess your issue has something to do with that, because again, my example above is working perfectly.

agazzarini commented 8 years ago

I meant your local Model.

hansidm commented 8 years ago

Hi @agazzarini,

I have created a new project with just that

    public static void main(String args[]) {
        Model model = ModelFactory.createDefaultModel();
        DatasetAccessor accessor = DatasetAccessorFactory.createHTTP("http://127.0.0.1:8983/solr/store/rdf-graph-store");    
        model.read(".....", "TTL");
        model.write(System.out, "TTL");
        accessor.add(model);
    }

The model is written to the console correctly. But when I can accessor.add, I get the following: Exception in thread "main" org.apache.jena.atlas.web.HttpException: 500 - Server Error

    at org.apache.jena.riot.web.HttpOp.exec(HttpOp.java:1107)
    at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:718)
    at org.apache.jena.riot.web.HttpOp.execHttpPost(HttpOp.java:686)
    at org.apache.jena.web.DatasetGraphAccessorHTTP.doPost(DatasetGraphAccessorHTTP.java:209)
    at org.apache.jena.web.DatasetGraphAccessorHTTP.httpPost(DatasetGraphAccessorHTTP.java:199)
    at org.apache.jena.web.DatasetAdapter.add(DatasetAdapter.java:91)
    at solrTest.Main.main(Main.java:29)

I'm using Jena 3.0.1. The stack trace on Solr is the same that I previously pasted here.

hansidm commented 8 years ago

UPDATE: I recompiled SolRDF master branch (all integration tests successful). Same error. Also, I have tried with the sample dataset bsbm-generated-dataset.nt. Same error.

I am using Solr 5.3.2.

hansidm commented 8 years ago

UPDATE: The issue has to do with the use of the JTS Topology Suite libraries. My Solr instance contains not only SolRDF collections, but also regular Solr collections that have one or more fields of the type solr.SpatialRecursivePrefixTreeFieldType. For that field type to work, JTS libs need to copied over to server/lib/ext directory inside Solr installation (they don't work when copied to the lib dir in the collection).

When the JTS lib is loaded by Solr, the RDF graph operations request to SolRDF start returning HTTP Error 500, with the internal exception and stack trace posted above.

agazzarini commented 8 years ago

@handsim can we close this issue? I guess it has little to do with SolRDF.

What do you think?

firmao commented 6 years ago

How do you solve the HttpException: 500 ?

agazzarini commented 6 years ago

Hi, that error is just a generic failure signal, you should check the system logs in order to understand what is the actual cause

Best, Andrea

On 5 Oct 2017 01:25, "Andre Valdestilhas" notifications@github.com wrote:

How do you solve the HttpException: 500 ?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/spaziocodice/SolRDF/issues/122#issuecomment-334317752, or mute the thread https://github.com/notifications/unsubscribe-auth/AHOA4FROqqJbiJp1sbv3quLZzHJOsQVjks5spBPogaJpZM4HkFM_ .