[
https://issues.apache.org/jira/browse/JENA-1292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15875028#comment-15875028
]
François-Paul Servant edited comment on JENA-1292 at 2/20/17 8:31 PM:
----------------------------------------------------------------------
if just making the change suggested at
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L402
the "@vocab" is added to the "@context", everything else remaining unchanged.
This is correct, but we keep a long context.
We would like to remove from the context the description of props that belong
to the ns corresponding to the empty prefix. This can be done near :
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L322
with something such as:
if (p.getNameSpace().equals(atVocabNS)) {
return;
}
But then, we do not benefit from the knowledge about the properties that belong
to the @vocab that can be extracted from the serialized model. For instance, if
@vocab is schema.org, and assuming all values of the "propInShemaDotOrg " are
resources, we had statements output such as :
"propInShemaDotOrg" : "http://a.com/aResource",
but we would now get
"propInShemaDotOrg" : {
"@id" : "http://a.com/aResource"
},
What could be done is to pass to the JSON-LD API the same context as now (that
is, including the description of properties that belong to the @vocab) to have
it use this knowledge in computing the output, and then replace the @context in
the output, with a version of it that contain the "@vocab" line, but not the
description of corresponding properties - basically, doing in JsonLDWriter what
I did in the workaround I gave in my answer on dev list: changing the @context
in output)
was (Author: fps61):
if just making the change suggested at
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L402
the "@vocab" is added to the "@context", everything else remaining unchanged.
This is correct, but we keep a long context.
We would like to remove from the context the description of props that belong
to the ns corresponding to the empty prefix. This can be done near :
https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L322
with something such as:
```
if (p.getNameSpace().equals(atVocabNS)) {
return;
}
```
But then, we do not benefit from the knowledge about the properties that belong
to the @vocab that can be extracted from the serialized model. For instance, if
@vocab is schema.org, and assuming all values of the "propInShemaDotOrg " are
resources, we had statements output as :
```
"propInShemaDotOrg" : "http://a.com/aResource",
```
but we would now get
```
"propInShemaDotOrg" : {
"@id" : "http://a.com/aResource"
},
```
What could be done is to pass to the JSON-LD API the same context as now (that
is, including the description of properties that belong to the @vocab) to have
it use this knowledge in computing the output, and then replace the @context in
the output, with a version of it that contain the "@vocab" line, but not the
description of corresponding properties - basically, doing in JsonLDWriter what
I did in the workaround I gave in my answer on dev list: changing the @context
in output)
> almost impossible to get @vocab prefix in JsonLDContext
> -------------------------------------------------------
>
> Key: JENA-1292
> URL: https://issues.apache.org/jira/browse/JENA-1292
> Project: Apache Jena
> Issue Type: Bug
> Components: RIOT
> Affects Versions: Jena 3.2.0
> Environment: Linux, Ecplise 4.2
> Reporter: Elie Roux
> Priority: Minor
> Labels: newbie
>
> It's almost impossible to get the empty prefix of a model mapped to Json-ld
> "@vocab" context, to do so I have to rebuild a context from scratch, which is
> not really nice...
> The fix should be a one-liner, see comment on
> https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/riot/writer/JsonLDWriter.java#L402
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)