@Override public ChangeApplied addAxiom(OWLOntology ont, OWLAxiom axiom) { if (sealed) { throw new DirectChangeApplicationNotAllowedException(); } return delegate.addAxiom(ont, axiom); }
@Override public OWLEntity visitOBJECTPROPERTYVariableType(OBJECTPROPERTYVariableType v) { OWLObjectProperty owlObjectProperty = factory.getOWLObjectProperty(create()); try { manager.addAxiom(scratchpad, factory.getOWLDeclarationAxiom(owlObjectProperty)); } catch (OWLOntologyChangeException e) { // should never happen throw new RuntimeException("Unexpected condition", e); } return owlObjectProperty; }
@Override public OWLEntity visitINDIVIDUALVariableType(INDIVIDUALVariableType v) { OWLNamedIndividual owlIndividual = factory.getOWLNamedIndividual(create()); try { manager.addAxiom(scratchpad, factory.getOWLDeclarationAxiom(owlIndividual)); } catch (OWLOntologyChangeException e) { // should never happen throw new RuntimeException("Unexpected condition", e); } return owlIndividual; }
@Override public OWLEntity visitDATAPROPERTYVariableType(DATAPROPERTYVariableType v) { OWLDataProperty owlDataProperty = factory.getOWLDataProperty(create()); try { manager.addAxiom(scratchpad, factory.getOWLDeclarationAxiom(owlDataProperty)); } catch (OWLOntologyChangeException e) { // should never happen throw new RuntimeException("Unexpected condition", e); } return owlDataProperty; }
@Override public OWLEntity visitCLASSVariableType(CLASSVariableType v) { OWLClass owlClass = factory.getOWLClass(create()); try { manager.addAxiom(scratchpad, factory.getOWLDeclarationAxiom(owlClass)); } catch (OWLOntologyChangeException e) { // should never happen throw new RuntimeException("Unexpected condition", e); } return owlClass; } }
public boolean addSubClassOf(Class clazz2) { return isChange(manager.addAxiom(onto, factory.getOWLSubClassOfAxiom(clazz,convert(clazz2)))); } public boolean removeSubClassOf(Class clazz2) {
public boolean addSubPropertyOf(Property property){ return isChange(manager.addAxiom(onto, factory.getOWLSubAnnotationPropertyOfAxiom(annoProp,convert((AnnotationProperty)property)))); } public boolean removeSubPropertyOf(Property property){
public boolean addDomain(Class clazz) { return isChange(manager.addAxiom(onto, factory.getOWLDataPropertyDomainAxiom(dataProp,convert(clazz)))); } public boolean removeDomain(Class clazz) {
/** * Asserts that the individual has a particular OWL type. */ public void assertOwlType(OWLClassExpression type) { OWLOntologyManager manager = owlOntology.getOWLOntologyManager(); OWLDataFactory factory = manager.getOWLDataFactory(); manager.addAxiom(owlOntology, factory.getOWLClassAssertionAxiom(type, owlIndividual)); }
public void addPropertyValue(OWLNamedIndividual i, OWLDataProperty p, Object o) { OWLLiteral literal = getLiteralFromObject(owlDataFactory, o); if (literal != null) { OWLAxiom axiom = owlDataFactory.getOWLDataPropertyAssertionAxiom(p, i, literal); manager.addAxiom(owlOntology, axiom); } else { throw new CodeGenerationRuntimeException("Invalid type for property value object " + o); } }
public boolean addType(Class clazz) { return isChange(manager.addAxiom(onto, factory.getOWLClassAssertionAxiom(convert(clazz),indiv))); } public boolean removeType(Class clazz) {
public boolean addSameAs(Individual individual) { return isChange(manager.addAxiom(onto, factory.getOWLSameIndividualAxiom(convert(individual),indiv))); } public boolean removeSameAs(Individual individual){
public boolean addDomain(Class clazz) { return isChange(manager.addAxiom(onto, factory.getOWLObjectPropertyDomainAxiom(objProp,convert(clazz)))); } public boolean removeDomain(Class clazz) {
public boolean addSubPropertyOf(Property property){ return isChange(manager.addAxiom(onto, factory.getOWLSubObjectPropertyOfAxiom(objProp,convert((ObjectProperty)property)))); } public boolean removeSubPropertyOf(Property property){
public boolean addEquivalentProperty(Property property) { return isChange(manager.addAxiom(onto, factory.getOWLEquivalentDataPropertiesAxiom(dataProp,convert((DatatypeProperty)property)))); } public boolean removeEquivalentProperty(Property property) {
public boolean addDisjointWith(Class clazz2) { return isChange(manager.addAxiom(onto, factory.getOWLDisjointClassesAxiom(clazz,convert(clazz2)))); } public boolean removeDisjointWith(Class clazz2) {
@Override public boolean addClass(Class type) { OWLClassExpression oce; if(type instanceof OWLAPIClass) { oce = ((OWLAPIClass)type).clazz; } else { oce = dataFactory.getOWLClass(IRI.create(type.getURI())); } final List<OWLOntologyChange> changes = manager.addAxiom(onto, dataFactory.getOWLSubClassOfAxiom(oce, dataFactory.getOWLClass(IRI.create(OWL+"Thing")))); return !changes.isEmpty(); }
@Override public boolean addObjectProperty(ObjectProperty op) { OWLObjectProperty oop; if(op instanceof OWLAPIObjectProperty) { oop = ((OWLAPIObjectProperty)op).objProp; } else { oop = dataFactory.getOWLObjectProperty(IRI.create(op.getURI())); } final List<OWLOntologyChange> changes = manager.addAxiom(onto, dataFactory.getOWLSubObjectPropertyOfAxiom(oop, dataFactory.getOWLObjectProperty(IRI.create(OWL+"topObjectProperty")))); return !changes.isEmpty(); }
public <X extends WrappedIndividualImpl> X createWrappedIndividual(String name, OWLClass type, Class<X> c) { OWLNamedIndividual i = owlDataFactory.getOWLNamedIndividual(IRI.create(name)); manager.addAxiom(owlOntology, owlDataFactory.getOWLClassAssertionAxiom(type, i)); if (!inference.canAs(i, type)) { return null; } return getWrappedIndividual(name, c); }
@Test public void doesNotReason_whenOntologyIsUnsatisfiable() throws Exception { OWLAxiom axiom = dataFactory.getOWLSubClassOfAxiom( dataFactory.getOWLClass(IRI.generateDocumentIRI()), dataFactory.getOWLNothing()); manager.addAxiom(ont, axiom); util.flush(); assertThat(util.shouldReason(), is(false)); }