I'm trying to use a "@id": "./" in a jsonld file and in another triple
"@id": "picture.jpg". The "./" will be correctly changed to the base URL,
but the "@id": "picture.jpg" just gets dropped and a blank node is
created. Below is the code segment that I used to generate this output:
{
"@context": [
"http://schema.org"
],
"@graph": [
{
"@type": "CreativeWork",
"@id": "picture.jpg"
},
{
"@id": "./",
"@type": "DataSet"
}
]
}
_:Bd42dbcf4e4ffb76e199766bf5e4c1e4b <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://schema.org/CreativeWork> .
<http://mydomain.com> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://schema.org/DataSet> .
If I use https://json-ld.org/playground/ on the same jsonld, I get:
<https://json-ld.org/playground/> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/DataSet>
.
<https://json-ld.org/playground/picture.jpg> <
http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <
http://schema.org/CreativeWork> .
which is what I expected. Am I missing something here? - Erich
String json = "{\n" +
" \"@context\": [\n" +
" \"http://schema.org\"\n" +
" ],\n" +
" \"@graph\": [\n" +
" {\n" +
" \"@type\": \"CreativeWork\",\n" +
" \"@id\": \"picture.jpg\"\n" +
" },\n" +
" {\n" +
" \"@id\": \"./\",\n" +
" \"@type\": \"DataSet\"\n" +
" }\n" +
" ]\n" +
"}";
System.out.println(json);
Model m = ModelFactory.createDefaultModel();
InputStream inputStream = new
ByteArrayInputStream(json.getBytes(Charset.forName("UTF-8")));
RDFParser.create()
.base("http://mydomain.com")
.source(inputStream)
.lang(RDFLanguages.JSONLD)
.parse(m);
RDFDataMgr.write(System.out, m, RDFFormat.NQUADS) ;