use of org.semanticweb.owlapi.model.OWLDocumentFormat in project graal by graphik-team.
the class OWL2Parser method getShortFormProvider.
// /////////////////////////////////////////////////////////////////////////
// PRIVATE METHODS
// /////////////////////////////////////////////////////////////////////////
private ShortFormProvider getShortFormProvider(OWLOntology ontology) {
OWLDocumentFormat format = this.manager.getOntologyFormat(this.ontology);
DefaultPrefixManager pm = new DefaultPrefixManager();
if (prefixEnable && format.isPrefixOWLOntologyFormat()) {
PrefixDocumentFormat prefixFormat = format.asPrefixOWLOntologyFormat();
Map<String, String> prefixMap = prefixFormat.getPrefixName2PrefixMap();
Set<String> forbiddenPrefix = new TreeSet<>();
forbiddenPrefix.add("xml:");
forbiddenPrefix.add("rdf:");
forbiddenPrefix.add("rdfs:");
forbiddenPrefix.add("owl:");
for (Map.Entry<String, String> entry : prefixMap.entrySet()) {
String prefix = entry.getKey();
if (!forbiddenPrefix.contains(prefix)) {
pm.setPrefix(prefix, entry.getValue());
prefix = prefix.substring(0, prefix.length() - 1);
buffer.write(new Prefix(prefix, entry.getValue()));
}
}
}
return pm;
}
Aggregations