Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions src/main/java/widoco/CreateResources.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,15 @@ public static void generateDocumentation(String outFolder, Configuration c, File
// serialize the model in different serializations.
OWLOntologyManager om = c.getMainOntology().getOWLAPIOntologyManager();
OWLOntology o = c.getMainOntology().getOWLAPIModel();
WidocoUtils.writeModel(om, o, new RDFXMLDocumentFormat(), folderOut + File.separator + "ontology.owl");
WidocoUtils.writeModel(om, o, new TurtleDocumentFormat(), folderOut + File.separator + "ontology.ttl");
WidocoUtils.writeModel(om, o, new NTriplesDocumentFormat(), folderOut + File.separator + "ontology.nt");
WidocoUtils.writeModel(om, o, new RDFJsonLDDocumentFormat(), folderOut + File.separator + "ontology.jsonld");
HashMap<String, String> serializations = c.getMainOntology().getSerializations();
WidocoUtils.writeModel(om, o, new RDFXMLDocumentFormat(),
folderOut + File.separator + getSerializationFileName(serializations, Constants.RDF_XML, "ontology.owl"));
WidocoUtils.writeModel(om, o, new TurtleDocumentFormat(),
folderOut + File.separator + getSerializationFileName(serializations, Constants.TTL, "ontology.ttl"));
WidocoUtils.writeModel(om, o, new NTriplesDocumentFormat(),
folderOut + File.separator + getSerializationFileName(serializations, Constants.NT, "ontology.nt"));
WidocoUtils.writeModel(om, o, new RDFJsonLDDocumentFormat(),
folderOut + File.separator + getSerializationFileName(serializations, Constants.JSON_LD, "ontology.jsonld"));
if (c.isIncludeIndex()) {
if(c.isIncludeAllSectionsInOneDocument()){
createUnifiedIndexDocument(abs,intro,overview,description,crossref,ref,changeLog, folderOut, c, lode, languageFile);
Expand All @@ -137,6 +142,26 @@ public static void generateDocumentation(String outFolder, Configuration c, File
}
}

/**
* Resolve the local file name to write a serialization to. The serialization
* value may be a bare file name or an absolute URL; in the latter case only
* the last path segment is used as the file name.
*/
private static String getSerializationFileName(HashMap<String, String> serializations, String key,
String defaultName) {
String value = serializations.get(key);
if (value == null || value.isEmpty()) {
return defaultName;
}
// strip query/fragment, then take the last path segment
String name = value.split("[?#]", 2)[0];
int lastSlash = name.lastIndexOf('/');
if (lastSlash >= 0) {
name = name.substring(lastSlash + 1);
}
return name.isEmpty() ? defaultName : name;
}

public static void generateSkeleton(String folderOut, Configuration c, Properties l) throws IOException {
// c.setTitle("Skeleton title");
c.setIncludeDiagram(false);
Expand Down