[ 
https://issues.apache.org/jira/browse/JENA-2069?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Seaborne updated JENA-2069:
--------------------------------
    Priority: Major  (was: Critical)

> JSON-LD serialisation and the base URI
> --------------------------------------
>
>                 Key: JENA-2069
>                 URL: https://issues.apache.org/jira/browse/JENA-2069
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Jena
>    Affects Versions: Jena 3.17.0
>            Reporter: Goksel Misirli
>            Priority: Major
>
> The Jena JSON-LD serialiser uses the @vocab keyword to represent the default 
> namespace when a Jena Model object has the default namespace URI defined. 
> However, explicitly setting a base URI does not seem to work and only the 
> default namespace is serialised.
>  RDFWriterBuilder writerBuilder = 
> RDFWriter.create().source(model).format(format);
>  writerBuilder.base(baseUri.toString());
> I believe the @base keyword should be used to represent the base URIs. For 
> example, in the Turtle representation, the base property can be used to infer 
> that the URI for the CodonOptimisationProtocol resource in the example below 
> is "https://sbolstandard.org/examples/CodonOptimisationProtocol";. As far as I 
> understand, in JSON-LD representation, the @vocab term would not be used to 
> infer the URIs for individual resources but for type definitions.
> My temporary solution is to remove the default namespace before serialising 
> the model to avoid the use of the @vocab keyword for now. The use of the 
> @vocab keyword would be ok, if the @base is also saved.
>  model.removeNsPrefix("");
> Please let me know if more information is needed.
> Please see below.
> Looking forward to hearing from you.
> Thanks
>  -----------------------
> [https://www.w3.org/TR/json-ld11/#default-vocabulary]
>  [https://www.w3.org/TR/json-ld11/#base-iri]
> TURTLE - Both the default namespace and the base URI can be defined using 
> Jena.
> {noformat}
> @base <https://sbolstandard.org/examples/> .
>  @prefix : <https://sbolstandard.org/examples/> .
>  @prefix sbol: <http://sbols.org/v3#> .
>  @prefix prov: <http://www.w3.org/ns/prov#> .
> :CodonOptimisationProtocol
>  a prov:Plan ;
>  sbol:description "Optimisation protocol to improve the translation of 
> mRNAs." ;
>  sbol:displayId "CodonOptimisationProtocol" ;
>  sbol:name "Codon Optimisation Protocol" .
>  {noformat}
> JSON-LD - Can't define the base URI using Jena.
>  {noformat}
>  {
>  "@id" : "CodonOptimisationProtocol",
>  "@type" : "prov:Plan",
>  "description" : "Optimisation protocol to improve the translation of mRNAs.",
>  "displayId" : "CodonOptimisationProtocol",
>  "name" : "Codon Optimisation Protocol",
>  "@context" : {
>    "description" : { "@id" : "http://sbols.org/v3#description"; } ,
>    "name" : { "@id" : "http://sbols.org/v3#name"; } ,
>    "displayId" : { "@id" : "http://sbols.org/v3#displayId"; },
>    "@vocab" : "https://sbolstandard.org/examples/";,
>    "sbol" : "http://sbols.org/v3#";,
>    "prov" : "http://www.w3.org/ns/prov#";
>  }
>  }
>  {noformat}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to