public void removeDataProperty(ModelContainer model, OWLNamedIndividual i, OWLDataProperty prop, OWLLiteral literal, METADATA metadata) { OWLAxiom toRemove = null; Set<OWLDataPropertyAssertionAxiom> existing = model.getAboxOntology().getDataPropertyAssertionAxioms(i); for (OWLDataPropertyAssertionAxiom ax : existing) { if (prop.equals(ax.getProperty()) && literal.equals(ax.getObject())) { toRemove = ax; break; } } if (toRemove != null) { removeAxiom(model, toRemove, metadata); } }
public void visit(OWLDataPropertyAssertionAxiom axiom) { if (!axiom.getSubject().isAnonymous()) { return; // not interesting for the anonymous individual forest } OWLAnonymousIndividual sub=axiom.getSubject().asOWLAnonymousIndividual(); nodes.add(sub); OWLClassExpression c=factory.getOWLDataHasValue(axiom.getProperty(),axiom.getObject()); if (nodelLabels.containsKey(sub)) { nodelLabels.get(sub).add(c); } else { Set<OWLClassExpression> labels=new HashSet<OWLClassExpression>(); labels.add(c); nodelLabels.put(sub,labels); } }
@Override public Void visit(OWLDataPropertyAssertionAxiom axiom) { long individual = getOrCreateNode(getIri(axiom.getSubject())); OWLDataProperty property = axiom.getProperty().asOWLDataProperty(); // TODO: fix this Set<OWLDataRange> ranges = property.getRanges(ontology); // Except without the ontology we can't verify the range... String propertyName = property.getIRI().toString(); Optional<Object> literal = OwlApiUtils.getTypedLiteralValue(axiom.getObject()); if (literal.isPresent()) { graph.setNodeProperty(individual, propertyName, literal.get()); if (mappedProperties.containsKey(propertyName)) { graph.addNodeProperty(individual, mappedProperties.get(propertyName), literal.get()); } } return null; }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values as integer */ public void addDataTypePropertyValue(String individual, String property, int value) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); axiom = factory.getOWLDataPropertyAssertionAxiom(dataProp, ind, value); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values */ public void addDataTypePropertyValue(String individual, String property, float value) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); axiom = factory.getOWLDataPropertyAssertionAxiom(dataProp, ind, value); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values */ public void addDataTypePropertyValue(String individual, String property, boolean value) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); axiom = factory.getOWLDataPropertyAssertionAxiom(dataProp, ind, value); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values */ public void addDataTypePropertyValue(String individual, String property, double value) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); axiom = factory.getOWLDataPropertyAssertionAxiom(dataProp, ind, value); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values */ public void addDataTypePropertyValue(String individual, String property, String value) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); axiom = factory.getOWLDataPropertyAssertionAxiom(dataProp, ind, value); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
/** * Set the following assertion DatatypePropertyAssertion( property * individual value ) If the properties or/and individual do not exist, they * will be created If the property is functional, previous values are * deleted. * * @param individual * owl named individual * @param property * datatype property IRI * @param value * datatype values */ public void addDataTypePropertyValue(String individual, String property, String value, String type) { OWLDataFactory factory = ontology.getOWLOntologyManager() .getOWLDataFactory(); OWLDataPropertyAssertionAxiom axiom = null; OWLDataProperty dataProp = factory.getOWLDataProperty(IRI .create(property)); OWLNamedIndividual ind = factory.getOWLNamedIndividual(IRI .create(individual)); if (dataProp.isFunctional(ontology)) deleteAllValuesOfProperty(individual, property); // OWLLiteral literal = new OWLLiteralImpl(factory, value, // factory.getOWLDatatype(IRI.create(type))); OWLLiteral literal = new OWLLiteralImplNoCompression(value, "", factory.getOWLDatatype(IRI.create(type))); axiom = factory .getOWLDataPropertyAssertionAxiom(dataProp, ind, literal); ontology.getOWLOntologyManager().addAxiom(ontology, axiom); reasoner.flush(); }
@Test public void toOwlDataPropertyAxiomUsesLanguageTagSpecifiedInAssertion() { final Axiom<String> ax = new AxiomImpl<>(NamedResource.create(INDIVIDUAL), Assertion.createDataPropertyAssertion(PROPERTY, "cs", false), new Value<>("cestina")); final OWLAxiom axiom = adapter.toOwlDataPropertyAssertionAxiom(ax); final OWLDataPropertyAssertionAxiom dpAxiom = (OWLDataPropertyAssertionAxiom) axiom; final OWLLiteral literal = dpAxiom.getObject(); assertEquals(ax.getValue().getValue(), literal.getLiteral()); assertEquals("cs", literal.getLang()); }
@Test public void toOwlDataPropertyAxiomUsesGloballyConfiguredLanguageWhenItIsNotSpecifiedInAssertion() { final Axiom<String> ax = new AxiomImpl<>(NamedResource.create(INDIVIDUAL), Assertion.createDataPropertyAssertion(PROPERTY, false), new Value<>("english")); final OWLAxiom axiom = adapter.toOwlDataPropertyAssertionAxiom(ax); final OWLDataPropertyAssertionAxiom dpAxiom = (OWLDataPropertyAssertionAxiom) axiom; final OWLLiteral literal = dpAxiom.getObject(); assertEquals(ax.getValue().getValue(), literal.getLiteral()); assertEquals(LANG, literal.getLang()); }
public Boolean visit(OWLDataPropertyAssertionAxiom axiom) { OWLIndividual sub=axiom.getSubject(); if (sub.isAnonymous()) { anonymousIndividualAxioms.add(axiom); return true; // will be checked afterwards by rolling-up } return reasoner.hasDataPropertyRelationship(sub.asOWLNamedIndividual(),axiom.getProperty().asOWLDataProperty(),axiom.getObject()); }
@Override public OWLDataPropertyAssertionAxiom visit( ElkDataPropertyAssertionAxiom axiom) { return owlFactory_.getOWLDataPropertyAssertionAxiom( convert(axiom.getProperty()), convert(axiom.getSubject()), convert(axiom.getObject())); }
@Override public T visit(OWLDataPropertyAssertionAxiom axiom) { throw new IllegalArgumentException( OWLDataPropertyAssertionAxiom.class.getSimpleName() + " cannot be converted to " + getTargetClass().getSimpleName()); }
@Override public Set<ComplexIntegerAxiom> visit(OWLDataPropertyAssertionAxiom axiom) { Objects.requireNonNull(axiom); Integer propertyId = translateDataProperty(asOWLDataProperty(axiom.getProperty())); Integer subjectId = translateIndividual(axiom.getSubject()); Integer objectId = translateLiteral(axiom.getObject()); ComplexIntegerAxiom ret = getAxiomFactory().createDataPropertyAssertionAxiom(propertyId, subjectId, objectId, translateAnnotations(axiom.getAnnotations())); return Collections.singleton(ret); }
@Override public void visit(OWLDataPropertyAssertionAxiom axiom) { hashCode = primes[2]; hashCode = hashCode * MULT + axiom.getSubject().hashCode(); hashCode = hashCode * MULT + axiom.getProperty().hashCode(); hashCode = hashCode * MULT + axiom.getObject().hashCode(); hashCode = hashCode * MULT + axiom.getAnnotations().hashCode(); }
@Override public OWLDataPropertyAssertionAxiom getAxiomWithoutAnnotations() { if (!isAnnotated()) { return this; } return new OWLDataPropertyAssertionAxiomImpl(getSubject(), getProperty(), getObject(), NO_ANNOTATIONS); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!super.equals(obj)) { return false; } return obj instanceof OWLDataPropertyAssertionAxiom; }
@Override public void visit(@Nonnull OWLDataPropertyAssertionAxiom axiom) { axiom.getSubject().accept(this); axiom.getProperty().accept(this); axiom.getObject().accept(this); processAxiomAnnotations(axiom); }
public void visit(OWLDataPropertyAssertionAxiom axiom) { notSupported(axiom); }
public void visit(OWLDataPropertyAssertionAxiom object) { visitProperty(object.getProperty()); }
public void visit(OWLDataPropertyAssertionAxiom axiom) { checkTopDataPropertyUse(axiom.getProperty(),axiom); addFact(axiom); }
public void visit(OWLDataPropertyAssertionAxiom object) { m_hasDatatypes=true; }
public void visit(OWLDataPropertyAssertionAxiom object) { Constant targetValue=(Constant)object.getObject().accept(m_dataRangeConverter); m_positiveFacts.add(getRoleAtom(object.getProperty(),getIndividual(object.getSubject()),targetValue)); }
public void visit(OWLDataPropertyAssertionAxiom object) { Constant targetValue=getConstant(object.getObject()); m_positiveFacts.add(getRoleAtom(object.getProperty(),getIndividual(object.getSubject()),targetValue)); }
@SuppressWarnings("static-method") public ElkDataPropertyAssertionAxiom convert( OWLDataPropertyAssertionAxiom owlDataPropertyAssertionAxiom) { return new ElkDataPropertyAssertionAxiomWrap<OWLDataPropertyAssertionAxiom>( owlDataPropertyAssertionAxiom); }
@Override public ElkAxiom visit(OWLDataPropertyAssertionAxiom axiom) { return CONVERTER.convert(axiom); }
@Override public ElkAssertionAxiom visit(OWLDataPropertyAssertionAxiom axiom) { return CONVERTER.convert(axiom); }
@Override public void visit(OWLDataPropertyAssertionAxiom axiom) { defaultVisit(axiom); }
@Override public OWLAxiom visit(OWLDataPropertyAssertionAxiom axiom) { return factory.getOWLDataPropertyAssertionAxiom(axiom.getProperty(), axiom.getSubject(), axiom.getObject(), annotations); }
@Override public void visit(OWLDataPropertyAssertionAxiom axiom) { }
@Override public Boolean visit(OWLDataPropertyAssertionAxiom axiom) { return true; }