public OWLContainer() { this(new RDFXMLOntologyFormat()); }
@Override public void startPrefixMapping(String prefix, String IRI) throws SAXException { super.startPrefixMapping(prefix, IRI); format.setPrefix(prefix, IRI); }
@Override public void addError(RDFResourceParseError error) { super.addError(error); failed = true; }
format.setParserMetaData(metaData);
public OWLConverter(IBSDLRegistry registry) { this(registry, new OWLContainer(new RDFXMLOntologyFormat())); }
public void startPrefixMapping(String prefix, String IRI) throws SAXException { super.startPrefixMapping(prefix, IRI); format.setPrefix(prefix, IRI); }
@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; }
private static void writeUntranslatableAxioms(final String path, Collection<OWLAxiom> untranslatableAxioms, OWLOntologyManager manager) throws IOException, OWLOntologyCreationException, OWLOntologyStorageException { // create temporary ontology with untranslatable axioms OWLOntology ontology = manager.createOntology(); Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(untranslatableAxioms); manager.addAxioms(ontology, axioms); // write temporary ontology to file final FileOutputStream outputStream = new FileOutputStream(new File(path)); OWLOntologyFormat format = new RDFXMLOntologyFormat(); // TODO make this configurable manager.saveOntology(ontology, format, outputStream); outputStream.close(); }
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; }
private boolean isOntologyRDFXML(OWLOntology owlOntology) { return owlOntologyManager.getOntologyFormat(owlOntology).equals(new RDFXMLOntologyFormat()); } }
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)); }
@Deprecated public static void printOntology(OWLOntology o, PrintStream printer) { OWLOntologyManager mgr = OWLManager.createOWLOntologyManager(); StringDocumentTarget tgt = new StringDocumentTarget(); try { mgr.saveOntology(o, new RDFXMLOntologyFormat(), tgt); } catch (OWLOntologyStorageException e) { e.printStackTrace(printer); } printer.println(tgt.toString()); }
@Deprecated public static void printOntology(OWLOntology o, PrintStream printer) { OWLOntologyManager mgr = OWLManager.createOWLOntologyManager(); StringDocumentTarget tgt = new StringDocumentTarget(); try { mgr.saveOntology(o, new RDFXMLOntologyFormat(), tgt); } catch (OWLOntologyStorageException e) { e.printStackTrace(printer); } printer.println(tgt.toString()); }
List<Object> formats = new ArrayList<Object>(); formats.add("Original"); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat());
List<Object> formats = new ArrayList<Object>(); formats.add("Original"); formats.add(new RDFXMLOntologyFormat()); formats.add(new OWLXMLOntologyFormat()); formats.add(new OWLFunctionalSyntaxOntologyFormat());
/** * * Converts a OWL API {@link OWLOntology} to Clerezza {@link Graph}. * * @param ontology * {@link OWLOntology} * @return the equivalent Clerezza {@link Graph}. */ public static org.apache.clerezza.commons.rdf.Graph owlOntologyToClerezzaGraph(OWLOntology ontology) { org.apache.clerezza.commons.rdf.Graph mGraph = null; ByteArrayOutputStream out = new ByteArrayOutputStream(); OWLOntologyManager manager = ontology.getOWLOntologyManager(); try { manager.saveOntology(ontology, new RDFXMLOntologyFormat(), out); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); ParsingProvider parser = new JenaParserProvider(); mGraph = new SimpleGraph(); parser.parse(mGraph, in, SupportedFormat.RDF_XML, null); } catch (OWLOntologyStorageException e) { log.error("Failed to serialize OWL Ontology " + ontology + "for conversion", e); } return mGraph; }
private static synchronized void cacheOntology(URI physicalRemoteUri, File file, OWLOntology ont) throws UnknownOWLOntologyException, OWLOntologyStorageException { uris.put(physicalRemoteUri, file); oiri.put(physicalRemoteUri, ont.getOntologyID().getOntologyIRI()); manager.setOntologyDocumentIRI(ont, IRI.create(file)); manager.saveOntology(ont, new RDFXMLOntologyFormat(), IRI.create(file)); }
private static synchronized void cacheOntology(URI physicalRemoteUri, File file, OWLOntology ont) throws UnknownOWLOntologyException, OWLOntologyStorageException { uris.put(physicalRemoteUri, file); oiri.put(physicalRemoteUri, ont.getOntologyID().getOntologyIRI()); manager.setOntologyDocumentIRI(ont, IRI.create(file)); manager.saveOntology(ont, new RDFXMLOntologyFormat(), IRI.create(file)); }
public static void printOntology(OWLOntology o, PrintStream printer) { OWLOntologyManager mgr = OWLManager.createOWLOntologyManager(); StringDocumentTarget tgt = new StringDocumentTarget(); try { mgr.saveOntology(o, new RDFXMLOntologyFormat(), tgt); } catch (OWLOntologyStorageException e) { e.printStackTrace(printer); } printer.println(tgt.toString()); }