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 OWLAxioms() { m_classes=new HashSet<OWLClass>(); m_objectProperties=new HashSet<OWLObjectProperty>(); m_objectPropertiesOccurringInOWLAxioms=new HashSet<OWLObjectProperty>(); m_complexObjectPropertyExpressions=new HashSet<OWLObjectPropertyExpression>(); m_dataProperties=new HashSet<OWLDataProperty>(); m_namedIndividuals=new HashSet<OWLNamedIndividual>(); m_conceptInclusions=new ArrayList<OWLClassExpression[]>(); m_dataRangeInclusions=new ArrayList<OWLDataRange[]>(); m_simpleObjectPropertyInclusions=new ArrayList<OWLObjectPropertyExpression[]>(); m_complexObjectPropertyInclusions=new ArrayList<ComplexObjectPropertyInclusion>(); m_disjointObjectProperties=new ArrayList<OWLObjectPropertyExpression[]>(); m_reflexiveObjectProperties=new HashSet<OWLObjectPropertyExpression>(); m_irreflexiveObjectProperties=new HashSet<OWLObjectPropertyExpression>(); m_asymmetricObjectProperties=new HashSet<OWLObjectPropertyExpression>(); m_disjointDataProperties=new ArrayList<OWLDataPropertyExpression[]>(); m_dataPropertyInclusions=new ArrayList<OWLDataPropertyExpression[]>(); m_facts=new HashSet<OWLIndividualAxiom>(); m_hasKeys=new HashSet<OWLHasKeyAxiom>(); m_definedDatatypesIRIs=new HashSet<String>(); m_rules=new HashSet<DisjunctiveRule>(); }
public boolean hasDataPropertyRelationship(OWLNamedIndividual subject, OWLDataProperty property, OWLLiteral object) { checkPreConditions(subject, property); if (!m_isConsistent) return true; OWLDataFactory factory = getDataFactory(); OWLAxiom notAssertion = factory .getOWLNegativeDataPropertyAssertionAxiom(property, subject, object); Tableau tableau = getTableau(notAssertion); boolean result = tableau.isSatisfiable(true, true, null, null, null, null, null, new ReasoningTaskDescription(true, "is {0} connected to {1} via {2}", H(subject), object, H(property))); tableau.clearAdditionalDLOntology(); return !result; }
public SKOSDataPropertyAssertionsFrame(OWLEditorKit owlEditorKit) { super(owlEditorKit.getModelManager().getOWLOntologyManager()); Set<OWLDataProperty> filterProps = new HashSet<OWLDataProperty>(7); // addSection(new SKOSDataPropertyAssertionAxiomFrameSection(owlEditorKit, this, owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.PREFLABEL.getIRI()), "SKOS preferred label")); // filterProps.add(owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.PREFLABEL.getIRI())); addSection(new SKOSDataPropertyAssertionAxiomFrameSection(owlEditorKit, this, owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.NOTATION .getIRI()), "SKOS notation")); filterProps.add(owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.NOTATION.getIRI())); // addSection(new SKOSDataPropertyAssertionAxiomFrameSection(owlEditorKit, this, owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.ALTLABEL.getIRI()), "SKOS alternate label")); // filterProps.add(owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.ALTLABEL.getIRI())); // addSection(new SKOSDataPropertyAssertionAxiomFrameSection(owlEditorKit, this, owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.HIDDENLABEL.getIRI()), "SKOS hidden label")); // filterProps.add(owlEditorKit.getModelManager().getOWLDataFactory().getOWLDataProperty(SKOSVocabulary.HIDDENLABEL.getIRI())); addSection(new SKOSOtherDataPropertyAssertionAxiomFrameSection(owlEditorKit, this, filterProps)); // addSection(new OWLDataPropertyAssertionAxiomFrameSection(owlEditorKit, this)); // addSection(new OWLNegativeObjectPropertyAssertionFrameSection(owlEditorKit, this)); // addSection(new OWLNegativeDataPropertyAssertionFrameSection(owlEditorKit, this)); }
protected boolean isFunctional(OWLDataProperty property) { checkPreConditions(property); if (!m_isConsistent) return true; AtomicRole atomicRole = H(property); Individual freshIndividual = Individual .createAnonymous("fresh-individual"); Constant freshConstantA = Constant.createAnonymous("fresh-constant-A"); Constant freshConstantB = Constant.createAnonymous("fresh-constant-B"); Set<Atom> assertions = new HashSet<Atom>(); assertions.add(atomicRole.getRoleAssertion(freshIndividual, freshConstantA)); assertions.add(atomicRole.getRoleAssertion(freshIndividual, freshConstantB)); assertions.add(Atom.create(Inequality.INSTANCE, freshConstantA, freshConstantB)); return !getTableau().isSatisfiable( false, assertions, null, null, null, null, new ReasoningTaskDescription(true, "functionality of {0}", atomicRole)); }
public void visit(SWRLDataRangeAtom atom) { if (atom.getArgument() instanceof SWRLVariable) throwVarError(atom); // dr(literal) :- // convert to: ClassAssertion(DataSomeValuesFrom(freshDP DataOneOf(literal)) freshIndividual) // and top -> \forall freshDP.dr OWLLiteral lit=((SWRLLiteralArgument)atom.getArgument()).getLiteral(); OWLDataRange dr=atom.getPredicate(); OWLNamedIndividual freshIndividual=getFreshIndividual(); OWLDataProperty freshDP=getFreshDataProperty(); OWLDataSomeValuesFrom some=m_factory.getOWLDataSomeValuesFrom(freshDP,m_factory.getOWLDataOneOf(lit)); OWLClassExpression definition=getDefinitionFor(some,m_alreadyExists); if (!m_alreadyExists[0]) m_newInclusions.add(new OWLClassExpression[] { negative(definition),some }); addFact(m_factory.getOWLClassAssertionAxiom(definition,freshIndividual)); m_newInclusions.add(new OWLClassExpression[] { m_factory.getOWLDataAllValuesFrom(freshDP,dr) }); }
@Override public void addToOntology() { OWLClass domain = featurePool.getExclusiveClass(":DatatypeMapsDomain"); OWLDatatype range = factory.getOWLDatatype(datatype); String namespace = datatype.getPrefixedName().split(":")[0]; String name = datatype.getShortForm(); String propertyIri = ":" + namespace + WordUtils.capitalize(name) + "Property"; OWLDataProperty property = factory.getOWLDataProperty(propertyIri, pm); addProperty(domain, property, range); }
@Override public void addToOntology() { OWLNamedIndividual source = factory.getOWLNamedIndividual(":NegativeDataPropertyAssertion_SourceIndividual", pm); OWLLiteral target = factory.getOWLLiteral("NegativeDataPropertyAssertion_TargetValue"); OWLDataProperty property = factory.getOWLDataProperty(":negativeDataPropertyAssertionProperty", pm); addAxiomToOntology(factory.getOWLNegativeDataPropertyAssertionAxiom(property, source, target)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataExactQualifiedCardinality", pm); OWLDatatype datatype = OWL2Datatype.XSD_STRING.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLDatatype affectedDatatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory); OWLDataExactCardinality cardinality = factory.getOWLDataExactCardinality(12, property, affectedDatatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataExactQualifiedCardinalityRange"), cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMaxQualifiedCardinality_RL", pm); OWLDatatype datatype = OWL2Datatype.RDFS_LITERAL.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLDatatype affectedDatatype = OWL2Datatype.XSD_BYTE.getDatatype(factory); OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(1, property, affectedDatatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataMaxQualifiedCardinalityRange_RL"), cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMinCardinality", pm); OWLDatatype datatype = OWL2Datatype.XSD_BOOLEAN.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLClass range = featurePool.getExclusiveClass(":DataMinCardinalityRange"); OWLDataMinCardinality cardinality = factory.getOWLDataMinCardinality(3, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMinQualifiedCardinality", pm); OWLDatatype datatype = OWL2Datatype.XSD_FLOAT.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLDatatype affectedDatatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory); OWLDataMinCardinality cardinality = factory.getOWLDataMinCardinality(9, property, affectedDatatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataMinQualifiedCardinalityRange"), cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMaxCardinality_RL", pm); OWLDatatype datatype = OWL2Datatype.XSD_FLOAT.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLClass range = featurePool.getExclusiveClass(":DataMaxCardinalityRange_RL"); OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(1, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMaxQualifiedCardinality", pm); OWLDatatype datatype = OWL2Datatype.RDFS_LITERAL.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLDatatype affectedDatatype = OWL2Datatype.XSD_BYTE.getDatatype(factory); OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(18, property, affectedDatatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataMaxQualifiedCardinalityRange"), cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataMaxCardinality", pm); OWLDatatype datatype = OWL2Datatype.XSD_FLOAT.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLClass range = featurePool.getExclusiveClass(":DataMaxCardinalityRange"); OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(19, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataExactCardinality", pm); OWLDatatype datatype = OWL2Datatype.XSD_STRING.getDatatype(factory); addToGenericDomainAndNewRange(property, datatype); OWLClass range = featurePool.getExclusiveClass(":DataExactCardinalityRange"); OWLDataExactCardinality cardinality = factory.getOWLDataExactCardinality(11, property); addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataHasValueProperty", pm); OWLDataHasValue restriction = factory.getOWLDataHasValue(property, factory.getOWLLiteral(6)); addToGenericDomainAndNewRange(property, OWL2Datatype.XSD_NON_NEGATIVE_INTEGER.getDatatype(factory)); OWLClass hasValue = featurePool.getExclusiveClass(":DataHasValue"); addAxiomToOntology(factory.getOWLSubClassOfAxiom(hasValue, restriction)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataSomeValuesFromProperty_RL", pm); OWLDatatype datatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory); OWLClass range = featurePool.getExclusiveClass(":DataSomeValuesFrom_RL"); OWLDataSomeValuesFrom restriction = factory.getOWLDataSomeValuesFrom(property, datatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(restriction, range)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataSomeValuesFromProperty", pm); OWLDatatype datatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory); OWLClass someValuesFrom = featurePool.getExclusiveClass(":DataSomeValuesFrom"); OWLDataSomeValuesFrom restriction = factory.getOWLDataSomeValuesFrom(property, datatype); addAxiomToOntology(factory.getOWLSubClassOfAxiom(someValuesFrom, restriction)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":dataAllValuesFromProperty", pm); OWLDatatype value = OWL2Datatype.XSD_INTEGER.getDatatype(factory); addToGenericDomainAndNewRange(property, value); OWLDataAllValuesFrom restriction = factory.getOWLDataAllValuesFrom(property, value); OWLClass allValuesFrom = featurePool.getExclusiveClass(":DataAllValuesFrom"); addAxiomToOntology(factory.getOWLSubClassOfAxiom(allValuesFrom, restriction)); }
@Override public void addToOntology() { OWLDatatype d1 = factory.getOWLDatatype(":DataUnionOf_Datatype1", pm); OWLDatatype d2 = factory.getOWLDatatype(":DataUnionOf_Datatype2", pm); OWLDataUnionOf union = factory.getOWLDataUnionOf(d1, d2); OWLDataProperty property = factory.getOWLDataProperty(":DataUnionOf", pm); addToGenericDomainAndNewRange(property, union); }
@Override public void addToOntology() { OWLDatatype datatype = factory.getOWLDatatype(":DatatypeRestrictionDatatype", pm); OWLFacetRestriction fr1 = factory.getOWLFacetRestriction(OWLFacet.MIN_LENGTH, 10); OWLLiteral patternLiteral = factory.getOWLLiteral("DatatypeRestrictionLiteral"); OWLFacetRestriction fr2 = factory.getOWLFacetRestriction(OWLFacet.PATTERN, patternLiteral); OWLDatatypeRestriction restriction = factory.getOWLDatatypeRestriction(datatype, fr1, fr2); OWLDataProperty property = factory.getOWLDataProperty(":datatypeRestrictionProperty", pm); addToGenericDomainAndNewRange(property, restriction); }
@Override public void addToOntology() { OWLDatatype d1 = factory.getOWLDatatype(":DatatypeIntersectionOf_Datatype1", pm); OWLDatatype d2 = factory.getOWLDatatype(":DatatypeIntersectionOf_Datatype2", pm); OWLDataIntersectionOf intersection = factory.getOWLDataIntersectionOf(d1, d2); OWLDataProperty property = factory.getOWLDataProperty(":datatypeIntersectionOfProperty", pm); addToGenericDomainAndNewRange(property, intersection); }
@Override public void addToOntology() { OWLDatatype d1 = OWL2Datatype.XSD_STRING.getDatatype(factory); OWLDatatype d2 = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory); OWLDataIntersectionOf intersection = factory.getOWLDataIntersectionOf(d1, d2); OWLDataProperty property = factory.getOWLDataProperty(":datatypeIntersectionOfProperty_OWL2", pm); addToGenericDomainAndNewRange(property, intersection); }
@Override public void addToOntology() { OWLClass domain = featurePool.getExclusiveClass(":Domain"); OWLDataProperty objectProperty = factory.getOWLDataProperty(":noRangeDataProperty", pm); addAxiomToOntology(factory.getOWLDataPropertyDomainAxiom(objectProperty, domain)); }
@Override public void addToOntology() { OWLDataProperty p1 = factory.getOWLDataProperty(":allDisjointDataProperties_Property1", pm); OWLDataProperty p2 = factory.getOWLDataProperty(":allDisjointDataProperties_Property2", pm); OWLDataProperty p3 = factory.getOWLDataProperty(":allDisjointDataProperties_Property3", pm); addAxiomToOntology(factory.getOWLDisjointDataPropertiesAxiom(p1, p2, p3)); OWLDatatype stringDatatype = OWL2Datatype.XSD_STRING.getDatatype(factory); addToGenericDomainAndNewRange(p1, stringDatatype); addToGenericDomainAndNewRange(p2, stringDatatype); addToGenericDomainAndNewRange(p3, stringDatatype); }
@Override public void addToOntology() { OWLDataProperty p1 = factory.getOWLDataProperty(":dataPropertyDisjointWith_Property1", pm); OWLDataProperty p2 = factory.getOWLDataProperty(":dataPropertyDisjointWith_Property2", pm); addAxiomToOntology(factory.getOWLDisjointDataPropertiesAxiom(p1, p2)); addToGenericDomainAndNewRange(p1, factory.getIntegerOWLDatatype()); addToGenericDomainAndNewRange(p2, OWL2Datatype.XSD_DECIMAL.getDatatype(factory)); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLDataProperty(":datatypeProperty", pm); OWLDatatype datatype = factory.getIntegerOWLDatatype(); addToGenericDomainAndNewRange(property, datatype); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLTopDataProperty(); OWLDatatype datatype = factory.getIntegerOWLDatatype(); addToGenericDomainAndNewRange(property, datatype); }
@Override public void addToOntology() { OWLDataProperty property = factory.getOWLBottomDataProperty(); OWLDatatype datatype = factory.getIntegerOWLDatatype(); addToGenericDomainAndNewRange(property, datatype); }
@Override public void addToOntology() { OWLDataProperty p1 = factory.getOWLDataProperty(":equivalentDataProperty_1", pm); OWLDataProperty p2 = factory.getOWLDataProperty(":equivalentDataProperty_2", pm); OWLDataProperty p3 = factory.getOWLDataProperty(":equivalentDataProperty_3", pm); addAxiomToOntology(factory.getOWLEquivalentDataPropertiesAxiom(p1, p2, p3)); OWLDatatype datatype = OWL2Datatype.XSD_NON_NEGATIVE_INTEGER.getDatatype(factory); addToGenericDomainAndNewRange(p1, datatype); addToGenericDomainAndNewRange(p2, datatype); addToGenericDomainAndNewRange(p3, datatype); }
@Override public void addToOntology() { OWLClass start = featurePool.getReusableClass(); OWLDatatype subRange = OWL2Datatype.XSD_STRING.getDatatype(factory); OWLDatatype superRange = OWL2Datatype.XSD_STRING.getDatatype(factory); OWLDataProperty subProperty = factory.getOWLDataProperty(":subDataProperty", pm); OWLDataProperty superProperty = factory.getOWLDataProperty(":superDataProperty", pm); addProperty(start, subProperty, subRange); addProperty(start, superProperty, superRange); addAxiomToOntology(factory.getOWLSubDataPropertyOfAxiom(subProperty, superProperty)); }
@Override public void addToOntology() { OWLDatatype datatype = OWL2Datatype.RDFS_LITERAL.getDatatype(factory); OWLDataProperty objectProperty = factory.getOWLDataProperty(":noDomainDataProperty", pm); addAxiomToOntology(factory.getOWLDataPropertyRangeAxiom(objectProperty, datatype)); }
@Override public void addToOntology() { OWLDataProperty dataProperty = factory.getOWLDataProperty(":functionalDataProperty", pm); OWLDatatype datatype = OWL2Datatype.XSD_NON_NEGATIVE_INTEGER.getDatatype(factory); addToGenericDomainAndNewRange(dataProperty, datatype); addAxiomToOntology(factory.getOWLFunctionalDataPropertyAxiom(dataProperty)); }
@Override public void addToOntology() { OWLClass hasKeyClass = featurePool.getExclusiveClass(":HasKeyClass"); OWLDataProperty hasKeyProperty1 = factory.getOWLDataProperty(":hasKeyProperty_1", pm); OWLDatatype hasKeyRange1 = OWL2Datatype.XSD_STRING.getDatatype(factory); addProperty(hasKeyClass, hasKeyProperty1, hasKeyRange1); OWLObjectProperty hasKeyProperty_2 = featurePool.getExclusiveProperty(":hasKeyProperty_2"); OWLClass hasKeyRange2 = featurePool.getExclusiveClass(":HasKeyPropertyRange_2"); addProperty(hasKeyClass, hasKeyProperty_2, hasKeyRange2); addAxiomToOntology(factory.getOWLHasKeyAxiom(hasKeyClass, hasKeyProperty1, hasKeyProperty_2)); }
/** * Get the {@link OWLDataProperty} object corresponding to a named data * property (i.e. attribute in OO) of the ontology. * @param onto * @param name * @return */ public static OWLDataProperty getOntoDataProperty(OWLOntology onto, String name) { for (OWLDataProperty p : onto.getDataPropertiesInSignature()) if (p.getIRI().getFragment().equals(name)) return p; return null; }
/** * create axioms for class--dataproperty----literal relation. * * @param src * @param dataprop * @param dest * @return */ private void getClass2DataProperty2LiteralAxioms(OWLClass src, OWLDataProperty dataprop, OWLLiteral dest) { // Set<OWLAxiom> tmpaxioms = new HashSet<OWLAxiom>(); OWLAxiom axiom; OWLDataSomeValuesFrom owlDataSomeValuesFrom; OWLDataHasValue owlLDataHasValue; OWLDataMaxCardinality owlDataMaxCardinality; OWLDataOneOf owldataOneOf; // set domain and range // scoped domain if (editor.isGenerateDomainAxiom()) { owlLDataHasValue = owlDataFactory.getOWLDataHasValue(dataprop, dest); axiom = owlDataFactory.getOWLSubClassOfAxiom(owlLDataHasValue, src); domainAndRangeAxioms.add(axiom); owlDataSomeValuesFrom = owlDataFactory.getOWLDataSomeValuesFrom(dataprop, owlDataFactory.getTopDatatype()); axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataSomeValuesFrom, src); domainAndRangeAxioms.add(axiom); } if (editor.isGenerateCardinalityAxiom()) { owlDataMaxCardinality = owlDataFactory.getOWLDataMaxCardinality(1, dataprop, owlDataFactory.getTopDatatype()); axiom = owlDataFactory.getOWLSubClassOfAxiom(owlDataFactory.getOWLThing(), owlDataMaxCardinality); cardinalityAxioms.add(axiom); // need to verify with Adila owlDataMaxCardinality = owlDataFactory.getOWLDataMaxCardinality(1, dataprop, owlDataFactory.getTopDatatype()); axiom = owlDataFactory.getOWLSubClassOfAxiom(src, owlDataMaxCardinality); cardinalityAxioms.add(axiom); } // return tmpaxioms; }
@Override public OWLDataProperty convert(ElkDataProperty input) { if (input instanceof ElkDataPropertyWrap<?>) { return ((ElkDataPropertyWrap<?>) input).getOwlObject(); } // else return visit(input); }