buda-base / lds-pdi

http://purl.bdrc.io BDRC Linked Data Server
Apache License 2.0
2 stars 0 forks source link

consider the use of base URI in ontology model serialization #119

Closed eroux closed 5 years ago

eroux commented 5 years ago

The base URI in serialization of ontologies is useful for TBC (and maybe other softwares). It can be passed as the third argument of model.write and would need to be changed in here and possibly other places.

MarcAgate commented 5 years ago

Ok. Regarding the use of sttl, we have now an issue since TTLRDFWriter.strLangSttl (i.e "STTL") is not a jena Format. We have used it so far by associating it with text/turtle mime type or ttl extension and it works as long as we used it for writing ttl files (using STTLWriter instead of Jena Model.write()). However, we are now also reading ttl files (ontology files) here using the ext which in MediaTypeUtils is associated with "SSTL" (I actually disabled that until we find a solution here) when we should have "TURTLE" (for model.read() method). I am not sure there is an elegant and light way to fix that (i.e without hardcoding that very special case in ontology reading)

eroux commented 5 years ago

Hmm, I see... well, we can always have

        ExtToJenaRead = new HashMap<>();
        ExtToJenaRead.put("nt",   RDFLanguages.strLangNTriples);
        ExtToJenaRead.put("nq",   RDFLanguages.strLangNQuads);
        ExtToJenaRead.put("trig", RDFLanguages.strLangTriG);
        ExtToJenaRead.put("rdf",  RDFLanguages.strLangRDFXML);
        ExtToJenaRead.put("owl",  RDFLanguages.strLangRDFXML);
        ExtToJenaRead.put("jsonld", RDFLanguages.strLangJSONLD);
        ExtToJenaRead.put("rt",   RDFLanguages.strLangRDFTHRIFT);
        ExtToJenaRead.put("rj",   RDFLanguages.strLangRDFJSON);
        ExtToJenaRead.put("json", RDFLanguages.strLangRDFJSON);
        ExtToJenaRead.put("trix", RDFLanguages.strLangTriX);

        ExtToJenaWrite = new HashMap<>(ExtToJenaRead);
        ExtToJenaWrite.put("ttl",  TTLRDFWriter.strLangSttl);
        ExtToJenaRead.put("ttl",  RDFLanguages.strLangTurtle);

that looks like a reasonably cheap solution...

MarcAgate commented 5 years ago

Yes, I wanted to avoid creating Maps for write and read, but it's not that "heavy" as you point it. I will do that

eroux commented 5 years ago

About the base url in xml, can you try changing the prefixes a bit? Removing the bdo prefix or adding an empty prefixes for instance