public void visit(SWRLDataRangeAtom at) { OWLDataRange dr=at.getPredicate(); SWRLDArgument argument=at.getArgument(); if (!(argument instanceof SWRLVariable)) throw new IllegalArgumentException("A SWRL rule contains a data range with an argument that is not a literal, and such rules are not supported."); if (!m_isPositive) dr=m_factory.getOWLDataComplementOf(dr); dr=m_expressionManager.getNNF(m_expressionManager.getSimplified(dr)); if (dr instanceof OWLDataIntersectionOf || dr instanceof OWLDataUnionOf) { OWLDatatype definition=getDefinitionFor(dr,m_alreadyExists); if (!m_alreadyExists[0]) m_dataRangeInclusions.add(new OWLDataRange[] { negative(definition),dr }); dr=definition; } SWRLAtom atom=m_factory.getSWRLDataRangeAtom(dr,argument); m_normalizedHeadAtoms.add(atom); m_headDataRangeVariables.add((SWRLVariable)argument); }
public Object visit(OWLDatatype object) { String datatypeURI=object.getIRI().toString(); if (InternalDatatype.RDFS_LITERAL.getIRI().equals(datatypeURI)) return InternalDatatype.RDFS_LITERAL; if (datatypeURI.startsWith("internal:defdata#") || m_definedDatatypeIRIs.contains(object.getIRI().toString())) return InternalDatatype.create(datatypeURI); DatatypeRestriction datatype=DatatypeRestriction.create(datatypeURI,DatatypeRestriction.NO_FACET_URIs,DatatypeRestriction.NO_FACET_VALUES); if (datatypeURI.startsWith("internal:unknown-datatype#")) m_allUnknownDatatypeRestrictions.add(datatype); else { try { DatatypeRegistry.validateDatatypeRestriction(datatype); } catch (UnsupportedDatatypeException e) { if (m_ignoreUnsupportedDatatypes) { if (m_warningMonitor!=null) m_warningMonitor.warning("Ignoring unsupported datatype '"+object.getIRI().toString()+"'."); m_allUnknownDatatypeRestrictions.add(datatype); } else throw e; } } return datatype; }
public Boolean visit(OWLDatatypeDefinitionAxiom axiom) { reasoner.throwInconsistentOntologyExceptionIfNecessary(); if (!reasoner.isConsistent()) return true; if (reasoner.m_dlOntology.hasDatatypes()) { OWLDataFactory factory=reasoner.getDataFactory(); OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual"); OWLDataProperty freshDataProperty=factory.getOWLDataProperty(IRI.create("fresh-data-property")); OWLDataRange dataRange=axiom.getDataRange(); OWLDatatype dt=axiom.getDatatype(); OWLDataIntersectionOf dr1=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dataRange),dt); OWLDataIntersectionOf dr2=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dt),dataRange); OWLDataUnionOf union=factory.getOWLDataUnionOf(dr1,dr2); OWLClassExpression c=factory.getOWLDataSomeValuesFrom(freshDataProperty,union); OWLClassAssertionAxiom ax=factory.getOWLClassAssertionAxiom(c,freshIndividual); Tableau tableau=reasoner.getTableau(ax); return !tableau.isSatisfiable(true,true,null,null,null,null,null,ReasoningTaskDescription.isAxiomEntailed(axiom)); } else return false; }
/** * @param literal the lexical form * @param lang the language; can be null or an empty string, in which case datatype can be any * datatype but not null * @param datatype the datatype; if lang is null or the empty string, it can be null or it MUST * be RDFPlainLiteral */ public OWLLiteralImpl(@Nonnull String literal, @Nullable String lang, @Nullable OWLDatatype datatype) { this.literal = new LiteralWrapper(checkNotNull(literal, "literal cannot be null")); if (lang == null || lang.isEmpty()) { language = ""; if (datatype == null) { this.datatype = RDF_PLAIN_LITERAL; } else { this.datatype = datatype; } } else { if (datatype != null && !datatype.isRDFPlainLiteral()) { // ERROR: attempting to build a literal with a language tag and // type different from plain literal throw new OWLRuntimeException("Error: cannot build a literal with type: " + datatype.getIRI() + " and language: " + lang); } language = lang; this.datatype = RDF_PLAIN_LITERAL; } hashcode = getHashCode(literal); }
private void checkInconsistentProperty(OWLDataProperty dp, OWLDatatype type) { for (OWLDataPropertyRangeAxiom a : dprAxioms) { OWLDataPropertyExpression pe = a.getProperty(); OWLDataRange r = a.getRange(); // TODO: check DataOneOf // TODO: check OWLDataIntersectionOf OWLDatatype otype = r.asOWLDatatype(); if (!pe.isAnonymous()) { if (!otype.equals(type)) { problems.add("The literal value restriction " + dp + " is inconsistent with the data property " + "range axiom " + a); } } else { problems.add("Found anonymous data property expression in data property range axiom: " + pe); } } }
@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() { 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(":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 datatype = factory.getOWLDatatype(":DataOneOf", pm); OWLLiteral l1 = factory.getOWLLiteral("DataOneOf_Literal1"); OWLLiteral l2 = factory.getOWLLiteral("DataOneOf_Literal2"); OWLLiteral l3 = factory.getOWLLiteral("DataOneOf_Literal3"); OWLDataOneOf owlDataOneOf = factory.getOWLDataOneOf(l1, l2, l3); addAxiomToOntology(factory.getOWLDatatypeDefinitionAxiom(datatype, owlDataOneOf)); }
@Override public void addToOntology() { OWLDatatype datatype = factory.getOWLDatatype(":DataOneOf_EL", pm); OWLLiteral singleLiteral = factory.getOWLLiteral("DataOneOf_EL_Literal1"); OWLDataOneOf owlDataOneOf = factory.getOWLDataOneOf(singleLiteral); addAxiomToOntology(factory.getOWLDatatypeDefinitionAxiom(datatype, owlDataOneOf)); }
@Override public void addToOntology() { OWLDatatype datatype = OWL2Datatype.XSD_STRING.getDatatype(factory); OWLDataComplementOf complement = factory.getOWLDataComplementOf(datatype); addToGenericDomainAndNewRange(factory.getOWLDataProperty(":dataComplementOfProperty", pm), complement); }
@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() { 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 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)); }
public Set<OWLDatatype> getBuiltinDatatypes(OWLModelManager owlModelManager) { Set<OWLDatatype> datatypes = new HashSet<>(); final OWLDataFactory df = owlModelManager.getOWLDataFactory(); datatypes.add(df.getTopDatatype()); for (OWL2Datatype dt : OWL2Datatype.values()) { datatypes.add(df.getOWLDatatype(dt.getIRI())); } return datatypes; }
public Set<OWLDatatype> getKnownDatatypes(OWLModelManager owlModelManager, Set<OWLOntology> onts) { Set<OWLDatatype> knownTypes = getBuiltinDatatypes(owlModelManager); for (OWLOntology ont : onts) { knownTypes.addAll(ont.getDatatypesInSignature()); } return knownTypes; }
/** * * @param value * @return */ private OWLDatatype getCustomOWLDataType(String value) { // if custom datatype what will happen ? OWLDatatype dt = owlDataFactory.getOWLDatatype(value, prefixManager); OWLAxiom ax = owlDataFactory.getOWLDeclarationAxiom(dt); declarationAxioms.add(ax); // System.out.println(dt); return dt; }