/** * Serializes a batch of triples corresponding to a predicate into one file. Upper bound: * TRIPLE_LIMIT_PER_FILE. */ private static int serializeTripleBatch( OWLOntology ontology, QuestOWLIndividualAxiomIterator iterator, String filePrefix, String predicateName, int fileCount, String format) throws Exception { String fileName = filePrefix + fileCount + ".owl"; OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); // Main buffer OWLOntology aBox = manager.createOntology(IRI.create(predicateName)); // Add the signatures for (OWLDeclarationAxiom axiom : ontology.getAxioms(AxiomType.DECLARATION)) { manager.addAxiom(aBox, axiom); } int tripleCount = 0; while (iterator.hasNext() && (tripleCount < TRIPLE_LIMIT_PER_FILE)) { manager.addAxiom(aBox, iterator.next()); tripleCount++; } // BufferedOutputStream output = new BufferedOutputStream(new // FileOutputStream(outputPath.toFile())); // BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(output, "UTF-8")); BufferedWriter writer = new BufferedWriter(new FileWriter(fileName)); manager.saveOntology(aBox, getOntologyFormat(format), new WriterDocumentTarget(writer)); return tripleCount; }
private void handleNotesOntologyChanged(List<OWLOntologyChange> changes) { try { OWLOntologyManager notesOntologyManager = notesOntology.getOWLOntologyManager(); if (notesOntologyManager.getOntologyFormat(notesOntology) instanceof BinaryOWLOntologyDocumentFormat) { OWLAPIProjectDocumentStore documentStore = OWLAPIProjectDocumentStore.getProjectDocumentStore(project.getProjectId()); List<OWLOntologyChangeData> infoList = new ArrayList<OWLOntologyChangeData>(); for (OWLOntologyChange change : changes) { OWLOntologyChangeRecord rec = change.getChangeRecord(); OWLOntologyChangeData info = rec.getData(); infoList.add(info); } BinaryOWLOntologyDocumentSerializer serializer = new BinaryOWLOntologyDocumentSerializer(); serializer.appendOntologyChanges( notesOntologyDocument, new OntologyChangeDataList(infoList, System.currentTimeMillis())); } else { // Swap it over notesOntologyManager.saveOntology(notesOntology, new BinaryOWLOntologyDocumentFormat()); } } catch (OWLOntologyStorageException e) { throw new RuntimeException(e); } catch (IOException e) { throw new RuntimeException(e); } }
protected void loadOntology() { try { manager = OWLManager.createOWLOntologyManager(); URI physicalURI = URI.create(PREFERENCES.getOntologyURL()); // Now do the loading ontology = manager.loadOntologyFromPhysicalURI(physicalURI); manager.setPhysicalURIForOntology(ontology, physicalURI); } catch (final Exception e) { Runnable runnable = new Runnable() { public void run() { JOptionPane.showMessageDialog( null, "Could not create the ontology. (This probably happened\n" + "because the ontology could not be accessed due to network\n" + "problems.)\n" + "[" + e.getMessage() + "]", "Error", JOptionPane.ERROR_MESSAGE); System.exit(1); } }; SwingUtilities.invokeLater(runnable); } }
public boolean contains(OWLClass cls) { if (cls.equals(owlOntologyManager.getOWLDataFactory().getOWLThing())) { return true; } else if (cls.equals(owlOntologyManager.getOWLDataFactory().getOWLNothing())) { return true; } return owlClass2ClassPointerMap.containsKey(cls); }
public boolean contains(OWLDataProperty prop) { if (prop.equals(owlOntologyManager.getOWLDataFactory().getOWLThing())) { return true; } else if (prop.equals(owlOntologyManager.getOWLDataFactory().getOWLNothing())) { return true; } return owlDataProperty2DataPropertyPointerMap.containsKey(prop); }
private void runWithSeparateFiles() { if (owlFile == null) { throw new NullPointerException("You have to specify an ontology file!"); } OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); OWLOntology ontology = null; OBDADataFactory obdaDataFactory = OBDADataFactoryImpl.getInstance(); try { ontology = manager.loadOntologyFromOntologyDocument((new File(owlFile))); if (disableReasoning) { /* * when reasoning is disabled, we extract only the declaration assertions for the vocabulary */ ontology = extractDeclarations(manager, ontology); } Collection<Predicate> predicates = new ArrayList<>(); for (OWLClass owlClass : ontology.getClassesInSignature()) { Predicate predicate = obdaDataFactory.getClassPredicate(owlClass.getIRI().toString()); predicates.add(predicate); } for (OWLDataProperty owlDataProperty : ontology.getDataPropertiesInSignature()) { Predicate predicate = obdaDataFactory.getDataPropertyPredicate(owlDataProperty.getIRI().toString()); predicates.add(predicate); } for (OWLObjectProperty owlObjectProperty : ontology.getObjectPropertiesInSignature()) { Predicate predicate = obdaDataFactory.getObjectPropertyPredicate(owlObjectProperty.getIRI().toString()); predicates.add(predicate); } OBDAModel obdaModel = loadMappingFile(mappingFile); Ontology inputOntology = OWLAPI3TranslatorUtility.translate(ontology); obdaModel.declareAll(inputOntology.getVocabulary()); int numPredicates = predicates.size(); int i = 1; for (Predicate predicate : predicates) { System.err.println(String.format("Materializing %s (%d/%d)", predicate, i, numPredicates)); serializePredicate(ontology, inputOntology, obdaModel, predicate, outputFile, format); i++; } } catch (OWLOntologyCreationException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } }
private OWLDescription createIncludeCoffeeDescription(Set<OWLClass> includeExtras) { OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras Set<OWLDescription> classes = new HashSet<OWLDescription>(); classes.add(getCoffeeClass()); // get OWL class for Coffee for (OWLClass extra : includeExtras) { classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } return manager.getOWLDataFactory().getOWLObjectIntersectionOf(classes); }
private OWLDescription createExcludeCoffeeDescription(Set<OWLClass> excludeExtras) { OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras Set<OWLDescription> classes = new HashSet<OWLDescription>(); // Everything must be a coffee for (OWLClass extra : excludeExtras) { classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } // are looking for. return manager.getOWLDataFactory().getOWLObjectUnionOf(classes); }
//////////////////////////////// // INDIVIDUAL ASSERTION METHODS// //////////////////////////////// public boolean assertSiteIndividual(String siteNameHash, String siteNameAnnotation) { OWLClassExpression tmpCE = OWLFactory.getOWLClass(":Site", topIxPrefixManager); OWLIndividual tmpInd = OWLFactory.getOWLNamedIndividual(':' + siteNameHash, topIxPrefixManager); manager.addAxiom(topIxOnt, OWLFactory.getOWLClassAssertionAxiom(tmpCE, tmpInd)); manager.addAxiom( topIxOnt, OWLFactory.getOWLAnnotationAssertionAxiom( OWLFactory.getOWLAnnotationProperty( IRI.create( topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + "individualName")), IRI.create(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + siteNameHash), OWLFactory.getOWLLiteral(siteNameAnnotation))); return true; }
public void check(ExistsCondition condition) throws VerificationException { Resource resource = condition.getResource(); assert resource.isInstantiated(); assert resource.isLoaded(); if (ONTOLOGY.equals(resource.getType().toString())) { URL url = (URL) resource.getValue(); OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); try { manager.loadOntologyFromPhysicalURI(url.toURI()); } catch (Exception x) { throw new VerificationException("The resource " + url + " cannot be parsed as ontology", x); } } }
/** setup fact++ reasoner */ protected void setupReasoner() { // run reasoner try { reasoner = new Reasoner(manager); } catch (Exception e) { e.printStackTrace(); // To change body of catch statement use File | Settings | File // Templates. } try { if (reasoner != null) { reasoner.loadOntologies(manager.getOntologies()); reasoner.classify(); } } catch (final OWLReasonerException e) { Runnable runnable = new Runnable() { public void run() { JOptionPane.showMessageDialog( null, "A reasoner error has ocurred.\n" + "[" + e.getMessage() + "]", "Reasoner Error", JOptionPane.ERROR_MESSAGE); } }; } ; }
public void saveOntology() { try { manager.saveOntology(topIxOnt); } catch (OWLOntologyStorageException ose) { System.out.println(ose.getMessage()); } }
public boolean assertHouseIndividual(String houseEntryHash, String houseEntryAnnotation) { OWLClassExpression tempClassExpression = OWLFactory.getOWLClass(":House", topIxPrefixManager); OWLIndividual tempIndividual = OWLFactory.getOWLNamedIndividual(':' + houseEntryHash, topIxPrefixManager); manager.addAxiom( topIxOnt, OWLFactory.getOWLClassAssertionAxiom(tempClassExpression, tempIndividual)); manager.addAxiom( topIxOnt, OWLFactory.getOWLAnnotationAssertionAxiom( OWLFactory.getOWLAnnotationProperty( IRI.create( topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + "individualName")), IRI.create(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + houseEntryHash), OWLFactory.getOWLLiteral(houseEntryAnnotation))); return true; }
private void createEmptyNotesOntology() { try { OWLOntologyManager notesOntologyManager = WebProtegeOWLManager.createOWLOntologyManager(); notesOntology = notesOntologyManager.createOntology(); IRI notesOntologyDocumentIRI = IRI.create(notesOntologyDocument); notesOntologyManager.setOntologyDocumentIRI(notesOntology, notesOntologyDocumentIRI); notesOntologyDocument.getParentFile().mkdirs(); BinaryOWLOntologyDocumentFormat notesOntologyDocumentFormat = new BinaryOWLOntologyDocumentFormat(); notesOntologyManager.saveOntology( notesOntology, notesOntologyDocumentFormat, notesOntologyDocumentIRI); } catch (OWLOntologyCreationException e) { throw new RuntimeException(e); } catch (OWLOntologyStorageException e) { throw new RuntimeException(e); } }
public void loadOntology() { try { /* * --apaitoymena vimata gia th dhmioyrgia mapped ontologias: * 1.dhmioyrgoyme ena toBeMappedIRI me skopo toy thn antistoixish me * to local File. 2.dhmioyrgoyme ena File me th dieythynsh ths * ontologias sto topiko apothikeytiko meso. 3.dhmioyrgoyme enan * SimpleIRIMapper kai ton prosthetoyme mesw toy manager. o * SimpleIRIMapper syndeei to toBeMappedIRI poy dwsame arxika, me * thn fysikh topothesia ths ontologias sto topiko apothikeytiko * meso. 4.dhmioyrgoyme ena ontologyIRI me akrivws thn idia arxiki * timh me to toBeMappedIRI to opoio tha einai to IRI ths ontologias * mas 5.dhmioyrgoyme thn ontologia mas xrhsimopoiwntas to * manager.loadOntology(ontologyIRI); */ String sep = File.separator; manager = OWLManager.createOWLOntologyManager(); toBeMappedIRI = IRI.create( "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl"); // ontFile = new File("../src/ontologyresources/ptyxiaki_v0.8.owl"); ontFile = new File("src/ontologyresources/ptyxiaki_v0.8.owl"); // in case of alternative location on load time when the application is jar'ed! if (!ontFile.canRead()) { ontFile = new File("ontologyresources/ptyxiaki_v0.8.owl"); } manager.addIRIMapper(new SimpleIRIMapper(toBeMappedIRI, IRI.create(ontFile))); ontologyIRI = IRI.create( "http://www.semanticweb.org/ontologies/ptyxiaki_v0.6/2011/5/Ontology1308067064597.owl"); topIxOnt = manager.loadOntology(ontologyIRI); OWLFactory = manager.getOWLDataFactory(); topIxFormat = manager.getOntologyFormat(topIxOnt); topIxPrefixManager = new DefaultPrefixManager(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#'); System.out.println("loaded ontology: " + this.topIxOnt); System.out.println("from: " + this.manager.getOntologyDocumentIRI(this.topIxOnt)); } catch (OWLException oex) { logger.info(oex.getMessage()); } }
private void importFile( InputStream in, IRI documentIRI, File inDir, Authorizations authorizations) throws Exception { byte[] inFileData = IOUtils.toByteArray(in); Reader inFileReader = new InputStreamReader(new ByteArrayInputStream(inFileData)); OWLOntologyLoaderConfiguration config = new OWLOntologyLoaderConfiguration(); OWLOntologyManager m = createOwlOntologyManager(config, documentIRI); OWLOntologyDocumentSource documentSource = new ReaderDocumentSource(inFileReader, documentIRI); OWLOntology o = m.loadOntologyFromOntologyDocument(documentSource, config); storeOntologyFile(new ByteArrayInputStream(inFileData), documentIRI); for (OWLClass ontologyClass : o.getClassesInSignature()) { if (!o.isDeclared(ontologyClass, false)) { continue; } importOntologyClass(o, ontologyClass, inDir, authorizations); } for (OWLDataProperty dataTypeProperty : o.getDataPropertiesInSignature()) { if (!o.isDeclared(dataTypeProperty, false)) { continue; } importDataProperty(o, dataTypeProperty); } for (OWLObjectProperty objectProperty : o.getObjectPropertiesInSignature()) { if (!o.isDeclared(objectProperty, false)) { continue; } importObjectProperty(o, objectProperty); } for (OWLObjectProperty objectProperty : o.getObjectPropertiesInSignature()) { if (!o.isDeclared(objectProperty, false)) { continue; } importInverseOf(o, objectProperty); } }
/** * @param entity * @return */ public String render(OWLEntity entity) { for (OWLOntology ont : manager.getOntologies()) { for (OWLAnnotation annot : entity.getAnnotations(ont)) { if (annot.getAnnotationURI().equals(OWLRDFVocabulary.RDFS_LABEL.getURI())) { if (annot instanceof OWLConstantAnnotation) { return ((OWLConstantAnnotation) annot).getAnnotationValue().getLiteral(); } } } } return entity.getURI().getFragment(); }
@Before public void setUp() { when(ontology.getOWLOntologyManager()).thenReturn(manager); when(manager.getOWLDataFactory()).thenReturn(dataFactory); when(dataFactory.getOWLThing()).thenReturn(owlThing); when(dataFactory.getOWLNothing()).thenReturn(owlNothing); when(dataFactory.getOWLTopObjectProperty()).thenReturn(owlTopObjectProperty); when(dataFactory.getOWLBottomObjectProperty()).thenReturn(owlBottomObjectProperty); when(dataFactory.getOWLTopDataProperty()).thenReturn(owlTopDataProperty); when(dataFactory.getOWLBottomDataProperty()).thenReturn(owlBottomDataProperty); reasoner = new NoOpReasoner(ontology, dataFactory); }
// asserts a hasHouse property instance between a house and its corresponding // site public boolean assertHasHousePropertyInstance(String houseEntryHash, String siteNameHash) { OWLObjectProperty objProp = OWLFactory.getOWLObjectProperty( IRI.create(topIxOnt.getOntologyID().getOntologyIRI() + "#hasHouse")); OWLIndividual houseIndividual = OWLFactory.getOWLNamedIndividual(':' + houseEntryHash, topIxPrefixManager); OWLIndividual siteIndividual = OWLFactory.getOWLNamedIndividual(':' + siteNameHash, topIxPrefixManager); manager.addAxiom( topIxOnt, OWLFactory.getOWLObjectPropertyAssertionAxiom(objProp, siteIndividual, houseIndividual)); return true; }
public boolean assertDataPropertyInstance(String ind, String prop, int value) { OWLDataProperty dataProp = OWLFactory.getOWLDataProperty( IRI.create(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + prop)); OWLDataPropertyAssertionAxiom tmpAx = OWLFactory.getOWLDataPropertyAssertionAxiom( dataProp, OWLFactory.getOWLNamedIndividual( IRI.create(topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + ind)), OWLFactory.getOWLLiteral(value)); manager.addAxiom(topIxOnt, tmpAx); return true; }
////////////////////////////// // PROPERTY ASSERTION METHODS// ////////////////////////////// public boolean assertPropertyInstance( String comboBoxObjectPropertyEntry, String room1Hash, String room2Hash) { OWLObjectProperty objProp = OWLFactory.getOWLObjectProperty( IRI.create(propEntryNametoPropEntryIRI.get(comboBoxObjectPropertyEntry))); OWLIndividual room1Individual = OWLFactory.getOWLNamedIndividual(':' + room1Hash, topIxPrefixManager); OWLIndividual room2Individual = OWLFactory.getOWLNamedIndividual(':' + room2Hash, topIxPrefixManager); manager.addAxiom( topIxOnt, OWLFactory.getOWLObjectPropertyAssertionAxiom(objProp, room1Individual, room2Individual)); return true; }
/** * Creates OWLDescription (query) by given included extras and excluded extras * * @param includeExtras * @param excludeExtras * @return */ private OWLDescription createCoffeeDescription( Set<OWLClass> includeExtras, Set<OWLClass> excludeExtras) { // Include means existential restrictions // Exclude means negated existential restrictions OWLObjectProperty prop = this.getNamedObjectProperty(PREFERENCES.getExtrasPropertyName()); // has_extras // Create a hash set to store the components (existential restrictions) // of our description Set<OWLDescription> classes = new HashSet<OWLDescription>(); // Everything must be a coffee classes.add(getCoffeeClass()); // get OWL class for Coffee // Create the existential restrictions that represent the extras // that we want to include. for (OWLClass extra : includeExtras) { // e.g. hasExtras some ex_A , hasExtras some ex_B classes.add(manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, extra)); } // Create the negated existential restrictions of the extras that we // want to exclude for (OWLClass excludeExtra : excludeExtras) { // has_topping some topping_A OWLDescription restriction = manager.getOWLDataFactory().getOWLObjectSomeRestriction(prop, excludeExtra); // not (has_topping some topping_A) OWLObjectComplementOf neg = manager.getOWLDataFactory().getOWLObjectComplementOf(restriction); classes.add(neg); } // Bind the whole thing up in an intersection class // to create a concept description of the coffee we // are looking for. return manager.getOWLDataFactory().getOWLObjectIntersectionOf(classes); }
public boolean assertRoomIndividual( String roomName, String roomIndividualHash, String roomIndividualAnnotation) { OWLClassExpression tempClassExpression = OWLFactory.getOWLClass( IRI.create( roomToIRI.get( roomName))); // retrieves the Room Class IRI fron the roomToIRI map, using // roomID as a key. OWLIndividual tempIndividual = OWLFactory.getOWLNamedIndividual(':' + roomIndividualHash, topIxPrefixManager); manager.addAxiom( topIxOnt, OWLFactory.getOWLClassAssertionAxiom(tempClassExpression, tempIndividual)); manager.addAxiom( topIxOnt, OWLFactory.getOWLAnnotationAssertionAxiom( OWLFactory.getOWLAnnotationProperty( IRI.create( topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + "individualName")), IRI.create( topIxOnt.getOntologyID().getOntologyIRI().toString() + '#' + roomIndividualHash), OWLFactory.getOWLLiteral(String.format(roomIndividualAnnotation)))); return true; }
public boolean assertHasRoomPropertyInstance( String houseIndividualHash, String roomIndividualHash) { OWLObjectProperty tempOWLbjectProperty = OWLFactory.getOWLObjectProperty( IRI.create(topIxOnt.getOntologyID().getOntologyIRI() + "#hasRoom")); OWLIndividual houseIndividual = OWLFactory.getOWLNamedIndividual(':' + houseIndividualHash, topIxPrefixManager); OWLIndividual roomIndividual = OWLFactory.getOWLNamedIndividual(':' + roomIndividualHash, topIxPrefixManager); manager.addAxiom( topIxOnt, OWLFactory.getOWLObjectPropertyAssertionAxiom( tempOWLbjectProperty, houseIndividual, roomIndividual)); return true; }
public void visit(OWLUntypedConstant node) { try { lastDataValuePointer = owlConstant2DataValuePointerMap.get(node); if (lastDataValuePointer == null) { owlOntologyManager .getOWLDataFactory() .getOWLDataType(XSDVocabulary.STRING.getURI()) .accept((OWLDataVisitor) this); lastDataValuePointer = faCTPlusPlus.getDataValue(node.getLiteral(), getLastDataTypePointer()); owlConstant2DataValuePointerMap.put(node, lastDataValuePointer); dataValuePointerMap.put(lastDataValuePointer, node); } } catch (Exception e) { throw new FaCTPlusPlusRuntimeException(e); } }
public void visit(OWLDataType dataType) { try { lastDataTypeExpressionPointer = null; lastDataTypePointer = (DataTypePointer) owlDataRange2DataTypeExpressionPointerMap.get(dataType); if (lastDataTypePointer == null) { if (owlOntologyManager.getOWLDataFactory().getTopDataType().equals(dataType)) { lastDataTypePointer = faCTPlusPlus.getDataTop(); } else { lastDataTypePointer = faCTPlusPlus.getBuiltInDataType(dataType.getURI().toString()); } owlDataRange2DataTypeExpressionPointerMap.put(dataType, lastDataTypePointer); dataTypeExpressionPointerMap.put(lastDataTypePointer, dataType); } } catch (Exception e) { throw new FaCTPlusPlusRuntimeException(e); } }
public void mergeOntologies() { List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for (OWLOntology ont : ontologies) { if (!ont.equals(targetOntology)) { // move the axioms for (OWLAxiom ax : ont.getAxioms()) { changes.add(new AddAxiom(targetOntology, ax)); } // move ontology annotations for (OWLAnnotation annot : ont.getAnnotations()) { changes.add(new AddOntologyAnnotation(targetOntology, annot)); } if (!targetOntology.getOntologyID().isAnonymous()) { // move ontology imports for (OWLImportsDeclaration decl : ont.getImportsDeclarations()) { if (ontologies.contains(ont.getOWLOntologyManager().getImportedOntology(decl))) { continue; } Optional<IRI> defaultDocumentIRI = targetOntology.getOntologyID().getDefaultDocumentIRI(); if (defaultDocumentIRI.isPresent() && !decl.getIRI().equals(defaultDocumentIRI.get())) { changes.add(new AddImport(targetOntology, decl)); } else { logger.warn( "Merge: ignoring import declaration for ontology " + targetOntology.getOntologyID() + " (would result in target ontology importing itself)."); } } } } } try { owlOntologyManager.applyChanges(changes); } catch (OWLOntologyChangeException e) { ErrorLogPanel.showErrorDialog(e); } }
/** * Gets the property by given name, e.g. has_topping * * @param propName * @return */ public OWLObjectProperty getNamedObjectProperty(String propName) { if (objPropNameCache == null) { objPropNameCache = new HashMap<String, URI>(); for (OWLOntology ont : reasoner.getLoadedOntologies()) { for (OWLObjectProperty prop : ont.getReferencedObjectProperties()) { objPropNameCache.put(prop.toString(), prop.getURI()); } } } // search the HashMap OWLObjectProperty namedProp = null; URI uri = objPropNameCache.get(propName); if (uri != null) { namedProp = manager.getOWLDataFactory().getOWLObjectProperty(uri); } else { System.err.println("Cannot find object property: " + propName + " in loaded ontologies"); } return namedProp; }
/** * Gets OWL class by given name * * @param className * @return * @throws OWLReasonerException */ public OWLClass getNamedClass(String className) { if (classnameCache == null) { classnameCache = new HashMap<String, URI>(); for (OWLOntology ont : reasoner.getLoadedOntologies()) { for (OWLClass cls : ont.getReferencedClasses()) { classnameCache.put(cls.toString(), cls.getURI()); } } } OWLClass namedCls = null; URI uri = classnameCache.get(className); if (uri != null) { namedCls = manager.getOWLDataFactory().getOWLClass(uri); } else { System.err.println("Cannot find class: " + className + " in loaded ontologies"); } return namedCls; }
private boolean isOBOFormat(OWLOntology ontology) { OWLOntologyManager man = ontology.getOWLOntologyManager(); return man.getOntologyFormat(ontology) instanceof OBOOntologyFormat; }