--
You received this message because you are subscribed to the Google Groups "vocbench-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vocbench-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vocbench-user/2fc58ef0-6060-4e64-97b7-22f6064ba014n%40googlegroups.com.
Hi Thomas!Thanks for your response :) Nice blog post, thanks!I guess I should use a VB reformatter to frame the JSON-LD serialization provided by VocBench with a framing specification?Otherwise I was thinking that maybe VocBench could use the prefixes defined in the Metadata > Namespaces and imports window? So the context would be built automatically.
I looked in the source code of VB and saw that it relies on RDF4J when exporting to JSON-LD. In the documentation of RDF4J it seems we can provide some configuration options to process a context like the JSONLD_MODE (compact, expand, flatten), and the OPTIMIZE.
To view this discussion on the web visit https://groups.google.com/d/msgid/vocbench-user/babab0bb-b686-4f41-b604-135c07589cc8n%40googlegroups.com.
import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.util.ModelBuilder;
import org.eclipse.rdf4j.model.vocabulary.OWL;
import org.eclipse.rdf4j.model.vocabulary.RDF;
import org.eclipse.rdf4j.model.vocabulary.RDFS;
import org.eclipse.rdf4j.rio.RDFFormat;
import org.eclipse.rdf4j.rio.Rio;
import org.eclipse.rdf4j.rio.WriterConfig;
import org.eclipse.rdf4j.rio.helpers.BasicWriterSettings;
import org.eclipse.rdf4j.rio.helpers.JSONLDMode;
import org.eclipse.rdf4j.rio.helpers.JSONLDSettings;
import java.net.URISyntaxException;
class Scratch {
public static void main(String[] args) throws URISyntaxException {
Model model = new ModelBuilder()
.setNamespace(OWL.NS)
.setNamespace(RDFS.NS)
.setNamespace("", "http://example.org/onto/")
.subject(":socrates")
.add(RDF.TYPE, ":Person")
.add(":knows", ":plato")
.subject(":Person")
.add(RDF.TYPE, OWL.CLASS)
.add(RDFS.SUBCLASSOF, ":Mortal")
.subject(":Mortal")
.add(RDF.TYPE, OWL.CLASS)
.build();
Rio.write(model, System.out, "", RDFFormat.JSONLD, new WriterConfig()
.set(JSONLDSettings.JSONLD_MODE, JSONLDMode.COMPACT)
.set(BasicWriterSettings.PRETTY_PRINT, true));
}
}
To view this discussion on the web visit https://groups.google.com/d/msgid/vocbench-user/CAPugn7UkBig4Ck94p4K52gM8XsreeS%3DNy%2BGxb1rCGYWm5OEHpQ%40mail.gmail.com.