Thank you very much for your help Andy! - Erich On Fri, Sep 18, 2020 at 9:28 AM Erich Bremer <[email protected]> wrote:
> Yes, just tested the code and does exactly that. The URL specified in > "base" replaces it out with "./". > The "./" is used in the creation of RO Crate metadata files in: > https://www.researchobject.org/ro-crate/1.0/#ro-crate-metadata-file-ro-crate-metadatajsonld > > > On Fri, Sep 18, 2020 at 9:25 AM Andy Seaborne <[email protected]> wrote: > >> >> >> On 18/09/2020 13:47, Erich Bremer wrote: >> > I want the base to be "./", meaning for: >> > >> > @prefix schema: <http://schema.org/> . >> > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . >> > >> > <http://njh.me/> >> > a schema:CreativeWork ; >> > schema:description "An impressive description"^^xsd:string ; >> > schema:name "This is an example of JSONLD"^^xsd:string . >> > >> > I want to write this out from the Jena model as the original somehow >> > swapping all http://njh.me/ out for "./": >> > >> > { >> > "@context": [ >> > "https://schema.org/" >> > ], >> > "@graph": [ >> > { >> > "@type": "CreativeWork", >> > "description": "An impressive description", >> > "name": "This is an example of JSONLD", >> > "@id": "./" >> > } >> > ] >> > } >> > >> > The only way I can imagine doing this at the moment is to serialized to >> > JSONLD and then do a search/replace on "http://njh.me/" with "./" >> >> Yes. >> >> Why do you needs "./" which is not a normalized IRI (the normalization >> ladder would make it "") >> >> >> >> Andy >> >> > >> > On Fri, Sep 18, 2020 at 4:44 AM Andy Seaborne <[email protected]> wrote: >> > >> >> >> >> RDFWriter.create() >> >> .base(baseURI) // <------ Valid URI. >> >> .lang(Lang.JSONLD) >> >> .source(model) >> >> .output(System.out); >> >> >> >> On 17/09/2020 22:44, Erich Bremer wrote: >> >>> I have JSONLD that looks like this: >> >>> >> >>> { >> >>> "@context": [ >> >>> "https://schema.org/" >> >>> ], >> >>> "@graph": [ >> >>> { >> >>> "@type": "CreativeWork", >> >>> "description": "An impressive description", >> >>> "name": "This is an example of JSONLD", >> >>> "@id": "./" >> >>> } >> >>> ] >> >>> } >> >>> >> >>> I can import it into Jena and convert to Turtle fine. How can I write >> >> from >> >>> a Jena Model back to JSON-LD but without a base getting @id like the >> one >> >>> above "./"? - Erich >> >>> >> >> >> > >> >
