@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 . so, in imaginary code, I need something like this for the TTL: RDFWriter.create() .swapbase("http://njh.me/", "./") // <------ Valid URI. .lang(Lang.JSONLD) .source(m) .output(System.out); to get: { "@context": [ "https://schema.org/" ], "@graph": [ { "@type": "CreativeWork", "description": "An impressive description", "name": "This is an example of JSONLD", "@id": "./" } ] } On Fri, Sep 18, 2020 at 8:47 AM Erich Bremer <[email protected]> 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 "./" > > 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 >> > >> >
