[ 
https://issues.apache.org/jira/browse/JENA-687?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13978230#comment-13978230
 ] 

Paolo Ciccarese commented on JENA-687:
--------------------------------------

I run the code in a Grails environment 
(https://github.com/Annotopia/AtSmartStorage) so it is not simple to extract 
runnable code.
Just to be clear, the same code reads perfectly content without multiple graphs.

For example the following JSON-LD content works absolutely fine:
{"@context":"https://raw2.github.com/Annotopia/AtSmartStorage/master/web-app/data/OAContext.json";
 ,"@id" : "urn:temp:001","@type" : 
"http://www.w3.org/ns/oa#Annotation","motivatedBy":"oa:commenting","annotatedBy":{"@id":"http://orcid.org/0000-0002-5156-2703","@type":"foaf:Person","foaf:name":"Paolo
 
Ciccarese"},"annotatedAt":"2014-02-17T09:46:11EST","serializedBy":"urn:application:domeo","serializedAt":"2014-02-17T09:46:51EST",
 "hasBody" : {"@type" : ["cnt:ContentAsText", "dctypes:Text"],"cnt:chars": 
"This is Paolo Ciccarese''s CV","dc:format": "text/plain"},"hasTarget" : 
"http://paolociccarese.info"}

In Grails, I defined these dependencies:
compile ("org.apache.jena:jena-core:2.11.2-SNAPSHOT") {
   excludes 'slf4j-api', 'xercesImpl'
}
compile ("org.apache.jena:jena-arq:2.11.2-SNAPSHOT")

I skimmed the code and, in the controller, I went down to exactly this:
String item = "{\"@context\": 
\"https://raw2.github.com/Annotopia/AtSmartStorage/master/web-app/data/OAContext.json\",\"@graph\":
 [{\"@id\": \"urn:temp:1\",\"@type\": \"rdf:Graph\",\"@graph\": {\"@id\": 
\"http://www.example.org/artifact1\",\"label\": \"yolo body 1\"}},{\"@id\": 
\"urn:temp:2\",\"@type\": \"rdf:Graph\",\"@graph\": {\"@id\": 
\"http://www.example.org/artifact2\",\"label\": \"yolo body 2\"}},{\"@id\": 
\"urn:temp:3\",\"@type\": \"rdf:Graph\",\"@graph\": {\"@id\": 
\"urn:temp:7\",\"@type\": \"oa:Annotation\",\"hasBody\": 
[\"urn:temp:1\",\"urn:temp:2\"],\"hasTarget\": 
\"http://paolociccarese.info\"}}]}";;             
Dataset inMemoryDataset = DatasetFactory.createMem();
System.out.println("Ready to read");
RDFDataMgr.read(inMemoryDataset, new 
ByteArrayInputStream(item.toString().getBytes("UTF-8")), RDFLanguages.JSONLD);
System.out.println("It never gets here"); 

It gets stuck on RDFDataMgr.read.
Not sure on how I can help further.

> Can't read JSON-LD with Named Graphs
> ------------------------------------
>
>                 Key: JENA-687
>                 URL: https://issues.apache.org/jira/browse/JENA-687
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena, RIOT
>    Affects Versions: Jena 2.11.2
>         Environment: Mac, Grails
>            Reporter: Paolo Ciccarese
>              Labels: JSON-LD
>
> With these two lines of code:
> Dataset inMemoryDataset = DatasetFactory.createMem();
> RDFDataMgr.read(inMemoryDataset, new 
> ByteArrayInputStream(item.toString().getBytes("UTF-8")), RDFLanguages.JSONLD);
> I am trying to read the following JSON-LD:
> {"@context": 
> "https://raw2.github.com/Annotopia/AtSmartStorage/master/web-app/data/OAContext.json","@graph":
>  [{"@id": "urn:temp:1","@type": "rdf:Graph","@graph": {"@id": 
> "http://www.example.org/artifact1","label": "yolo body 1"}},{"@id": 
> "urn:temp:2","@type": "rdf:Graph","@graph": {"@id": 
> "http://www.example.org/artifact2","label": "yolo body 2"}},{"@id": 
> "urn:temp:3","@type": "rdf:Graph","@graph": {"@id": "urn:temp:7","@type": 
> "oa:Annotation","hasBody": ["urn:temp:1","urn:temp:2"],"hasTarget": 
> "http://paolociccarese.info"}}]}
> The RIOT parser gets stuck. No exceptions, just stuck. I am sure I was able 
> to read the above three weeks ago.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to