@Override public boolean canStoreOntology(OWLOntologyFormat ontologyFormat) { return ontologyFormat.equals(new OWLXMLOntologyFormat()); }
try { System.setProperty("entityExpansionLimit", "100000000"); OWLXMLOntologyFormat format = new OWLXMLOntologyFormat(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); Map<String, String> prefix2NamespaceMap = handler.getPrefixName2PrefixMap(); for(String prefix : prefix2NamespaceMap.keySet()) { format.setPrefix(prefix, prefix2NamespaceMap.get(prefix));
OWLXMLOntologyFormat owlxmlFormat = new OWLXMLOntologyFormat(); owlxmlFormat.copyPrefixesFrom(format.asPrefixOWLOntologyFormat());
public boolean canStoreOntology(OWLOntologyFormat ontologyFormat) { return ontologyFormat.equals(new OWLXMLOntologyFormat()); }
public OWLOntologyFormat parse(OWLOntologyDocumentSource documentSource, OWLOntology ontology) throws OWLParserException, IOException, UnloadableImportException { try { System.setProperty("entityExpansionLimit", "100000000"); OWLXMLOntologyFormat format = new OWLXMLOntologyFormat(); SAXParserFactory factory = SAXParserFactory.newInstance(); factory.setNamespaceAware(true); Map<String, String> prefix2NamespaceMap = handler.getPrefixName2PrefixMap(); for(String prefix : prefix2NamespaceMap.keySet()) { format.setPrefix(prefix, prefix2NamespaceMap.get(prefix));
@Override public boolean setValue(String to) { if (to.equals("owlxml")) { this.value = new OWLXMLOntologyFormat(); } else if (to.contains("manchester")) { this.value = new ManchesterOWLSyntaxOntologyFormat(); } else if (to.contains("RDF")) { this.value = new RDFXMLOntologyFormat(); } else { failureMessage = "don't know format '" + to + "' -- reverting to default: " + value; return false; } return true; }
public static void logOntology(String message, OWLOntology ontology, Logger logger, Level level) { if (logger.isLoggable(level)) { logger.log(level, message); StringDocumentTarget out = new StringDocumentTarget(); try { ontology.getOWLOntologyManager().saveOntology(ontology, new OWLXMLOntologyFormat(), out); } catch (OWLOntologyStorageException e) { logger.log(level, "Could not display ontology", e); } logger.log(level, out.toString()); } }
public OntologyFormatPanel() { List<Object> formats = new ArrayList<Object>(); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat()); formats.add(new ManchesterOWLSyntaxOntologyFormat()); formats.add(new OBOOntologyFormat()); formats.add(new KRSS2OntologyFormat()); formats.add(new LatexOntologyFormat()); formats.add(new TurtleOntologyFormat()); formatComboBox = new JComboBox(formats.toArray()); setLayout(new BorderLayout(12, 12)); add(formatComboBox, BorderLayout.SOUTH); formatComboBox.setSelectedItem(formats.get(0)); }
public OntologyFormatPanel() { List<Object> formats = new ArrayList<Object>(); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat()); formats.add(new ManchesterOWLSyntaxOntologyFormat()); formats.add(new OBOOntologyFormat()); formats.add(new KRSS2OntologyFormat()); formats.add(new LatexOntologyFormat()); formats.add(new TurtleOntologyFormat()); formatComboBox = new JComboBox(formats.toArray()); setLayout(new BorderLayout(12, 12)); add(formatComboBox, BorderLayout.SOUTH); formatComboBox.setSelectedItem(formats.get(0)); }
protected OWLOntologyFormat parseFormat(CommandLine cmd) { OWLOntologyFormat format = new RDFXMLOntologyFormat(); String formatString = getOptionValue(cmd, ONTOLOGY_FORMAT_OPTION); if (formatString == null) { ; } else if (formatString.equals("owlxml")) { format = new OWLXMLOntologyFormat(); } else if (formatString.equals("rdfxml")) { format = new RDFXMLOntologyFormat(); } else if (formatString.equals("functional")) { format = new OWLFunctionalSyntaxOntologyFormat(); } else { System.out.println("Unknown format type " + formatString); } return format; }
formats.add("Original"); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat()); formatComboBox = new JComboBox(formats.toArray());
formats.add("Original"); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat()); formatComboBox = new JComboBox(formats.toArray());
manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out); } catch (OWLOntologyStorageException e) { log.error("Failed to store ontology for rendering.", e);
@Override public void write(Ontology ontology, DataTarget target, String format) { if (ontology instanceof OWLAPIOntology) { try { manager.saveOntology(((OWLAPIOntology) ontology).onto, IRI.create(target.asURL())); } catch (Exception x) { try { if (format.equals("RDFXML")) { manager.saveOntology(((OWLAPIOntology) ontology).onto, new RDFXMLOntologyFormat(), target.asOutputStream()); } else if (format.equals("TURTLE")) { manager.saveOntology(((OWLAPIOntology) ontology).onto, new TurtleOntologyFormat(), target.asOutputStream()); } else { manager.saveOntology(((OWLAPIOntology) ontology).onto, new OWLXMLOntologyFormat(), target.asOutputStream()); } } catch (Exception x2) { // log.stackTrace(x); // log.stackTrace(x); throw new RuntimeException("Could not write OWL ontology"); } } } else { throw new IllegalArgumentException("Cannot serializer an ontology I did not create!"); } }
@Override public void write(Ontology ontology, Writer target, OntologyFormat format) { if (ontology instanceof OWLAPIOntology) { try { if (format.equals(OntologyFormat.RDFXML)) { manager.saveOntology(((OWLAPIOntology) ontology).onto, new RDFXMLOntologyFormat(), new WriterDocumentTarget(target)); } else if (format.equals(OntologyFormat.TURTLE)) { manager.saveOntology(((OWLAPIOntology) ontology).onto, new TurtleOntologyFormat(), new WriterDocumentTarget(target)); } else if (format.equals(OntologyFormat.OWLXML)) { manager.saveOntology(((OWLAPIOntology) ontology).onto, new OWLXMLOntologyFormat(), new WriterDocumentTarget(target)); } else { throw new IllegalArgumentException("Unsupported format " + format); } } catch (Exception x2) { // log.stackTrace(x2); throw new RuntimeException("Could not write OWL ontology"); } } else { throw new IllegalArgumentException("Cannot serializer an ontology I did not create!"); } }
manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out); } catch (OWLOntologyStorageException e) { log.error("Failed to store ontology for rendering.", e);
else if (OWL_XML_TYPE.equals(mediaType)) format = new OWLXMLOntologyFormat(); else if (MANCHESTER_OWL_TYPE.equals(mediaType)) format = new ManchesterOWLSyntaxOntologyFormat(); else if (FUNCTIONAL_OWL_TYPE.equals(mediaType)) format = new OWLFunctionalSyntaxOntologyFormat();
manager.saveOntology(ontology, new OWLXMLOntologyFormat(), out); } catch (OWLOntologyStorageException e) { log.error("Failed to store ontology for rendering.", e);