public void visit(OWLObjectProperty owlObjectProperty) { try { lastObjectPropertyPointer = owlObjectProperty2ObjectPropertyPointerMap.get(owlObjectProperty); if (lastObjectPropertyPointer == null) { lastObjectPropertyPointer = faCTPlusPlus.getObjectProperty(owlObjectProperty.getURI().toString()); objectPropertyPointerMap.put(lastObjectPropertyPointer, owlObjectProperty); owlObjectProperty2ObjectPropertyPointerMap.put( owlObjectProperty, lastObjectPropertyPointer); } } catch (Exception e) { throw new FaCTPlusPlusRuntimeException(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; }