Ah, OK.  I saw that project, but didn't realize that was the more
appropriate one.  I'll give that a go tomorrow.   Thanks for the heads-up!


Phil
This message optimized for indexing by NSA PRISM


On Thu, Nov 14, 2013 at 2:48 AM, Stian Soiland-Reyes
<[email protected]> wrote:
> Try instead:
>
> https://github.com/jsonld-java/jsonld-java/tree/master/integration/jena
>
> Instructions and examples above.
>
> You will currently have to build jsonld-java from github , until version
> 0.3.0 is released.
> On 14 Nov 2013 00:47, "Phillip Rhodes" <[email protected]> wrote:
>
>> Jena gang:
>>
>> I am trying to store triples retrieved from Stanbol in JSON-LD format,
>> but having
>> no luck so far.  I'm using Jena 2.10.1 and using the Jena JSONLD project
>> from
>> https://github.com/afs/jena-jsonld
>>
>> My (Groovy) code looks like this:
>>
>>
>> static main(args)
>> {
>>     JenaJSONLD.init();
>>     def content = """Quoddy can now recognize famous people like
>> Richard Marx""";
>>
>>     // call Stanbol REST API to get enrichment data
>>     RESTClient restClient = new RESTClient( "http://localhost:8080"; )
>>
>>     // println "content submitted: ${content}";
>>     def restResponse = restClient.post( path:'enhancer',
>>                                                          body: content,
>>                                                       // headers:
>> ['Accept':'application/rdf+xml'],
>>
>> requestContentType : TEXT );
>>
>>     String restResponseText = restResponse.getData();
>>     println "restResponseText:\n ${restResponseText}\n\n";
>>
>>     // Make a TDB-backed dataset
>>     String directory = "MyDatabases/Dataset2" ;
>>     Dataset dataset = TDBFactory.createDataset(directory) ;
>>     dataset.begin(ReadWrite.READ) ;
>>     // Get model inside the transaction
>>     Model model = dataset.getDefaultModel() ;
>>     dataset.end() ;
>>
>>     dataset.begin(ReadWrite.WRITE) ;
>>     model = dataset.getDefaultModel() ;
>>     StringReader reader = new StringReader( restResponseText );
>>     model.read( reader, "http://www.example.com";, "JSON-LD" );
>>     // RDFDataMgr.read(model, reader, "http://example.com/";,
>> JenaJSONLD.JSONLD);
>>     dataset.commit();
>>     dataset.end();
>>
>>     println "done";
>> }
>>
>> and results in a NullPointerException like this:
>>
>> Caught: java.lang.NullPointerException
>> java.lang.NullPointerException
>> at org.apache.jena.riot.RDFDataMgr.processTriples(RDFDataMgr.java:796)
>> at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:289)
>> at org.apache.jena.riot.RDFDataMgr.read(RDFDataMgr.java:273)
>> at org.apache.jena.riot.adapters.RDFReaderRIOT.read(RDFReaderRIOT.java:61)
>> at com.hp.hpl.jena.rdf.model.impl.ModelCom.read(ModelCom.java:267)
>> at com.hp.hpl.jena.rdf.model.Model$read.call(Unknown Source)
>> at org.example.stanbol.StanbolJenaMain2.main(StanbolJenaMain2.groovy:58)
>>
>>
>> If I do the same thing with RDF/XML (and appropriate code changes) I
>> can save the triples fine.  But I really want to use JSON-LD, as I do
>> other stuff with the JSON-LD
>> that comes back, using Javascript on the client-side, and it makes
>> life a lot easier
>> if I just take the JSON-LD and use it everywhere.
>>
>>
>> Any thoughts? Am I doing something wrong, or is there just a bug in
>> the JSONLD module?  I can also post the blog of json that I get back
>> if it would help.
>>
>>
>> Thanks,
>>
>>
>> Phil
>>
>> This message optimized for indexing by NSA PRISM
>>

Reply via email to