@Override public OWLDataRange visit(OWLDataOneOf node) { if (node.getValues().size() == 1) { if (negated) { return dataFactory.getOWLDataComplementOf(node); } else { return node; } } else { // Encode as a data union of and return result Set<OWLDataOneOf> oneOfs = new HashSet<>(); for (OWLLiteral lit : node.getValues()) { oneOfs.add(dataFactory.getOWLDataOneOf(lit)); } return dataFactory.getOWLDataUnionOf(oneOfs).accept(this); } }
@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)); }
/** * 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; }
protected void axiomatizeTopDataProperty(OWLAxioms axioms) { OWLDatatype anonymousConstantsDatatype=m_factory.getOWLDatatype(IRI.create("internal:anonymous-constants")); OWLLiteral newConstant=m_factory.getOWLLiteral("internal:constant",anonymousConstantsDatatype); OWLDataOneOf oneOfNewConstant=m_factory.getOWLDataOneOf(newConstant); OWLDataSomeValuesFrom hasTopNewConstant=m_factory.getOWLDataSomeValuesFrom(m_topDataProperty,oneOfNewConstant); axioms.m_conceptInclusions.add(new OWLClassExpression[] { hasTopNewConstant }); }
public void visit(OWLClassAssertionAxiom axiom) { OWLClassExpression classExpression=axiom.getClassExpression(); if (classExpression instanceof OWLDataHasValue) { OWLDataHasValue hasValue=(OWLDataHasValue)classExpression; addFact(m_factory.getOWLDataPropertyAssertionAxiom(hasValue.getProperty(), axiom.getIndividual(), hasValue.getValue())); return; } if (classExpression instanceof OWLDataSomeValuesFrom) { OWLDataSomeValuesFrom someValuesFrom=(OWLDataSomeValuesFrom)classExpression; OWLDataRange dataRange=someValuesFrom.getFiller(); if (dataRange instanceof OWLDataOneOf) { OWLDataOneOf oneOf=(OWLDataOneOf)dataRange; if (oneOf.getValues().size()==1) { addFact(m_factory.getOWLDataPropertyAssertionAxiom(someValuesFrom.getProperty(),axiom.getIndividual(),oneOf.getValues().iterator().next())); return; } } } classExpression=positive(classExpression); if (!isSimple(classExpression)) { OWLClassExpression definition=getDefinitionFor(classExpression,m_alreadyExists); if (!m_alreadyExists[0]) m_classExpressionInclusionsAsDisjunctions.add(new OWLClassExpression[] { negative(definition),classExpression }); classExpression=definition; } addFact(m_factory.getOWLClassAssertionAxiom(classExpression,axiom.getIndividual())); }
public Object visit(OWLDataOneOf object) { Set<Constant> constants=new HashSet<Constant>(); for (OWLLiteral literal : object.getValues()) constants.add((Constant)literal.accept(this)); Constant[] constantsArray=new Constant[constants.size()]; constants.toArray(constantsArray); return ConstantEnumeration.create(constantsArray); }
protected static boolean isAtomic(OWLDataRange dr) { return dr instanceof OWLDatatype || dr instanceof OWLDatatypeRestriction || dr instanceof OWLDataOneOf; }
public OWLDataRange visit(OWLDataOneOf node) { return node; }
public OWLDataRange visit(OWLDataOneOf o) { return o; }
public OWLDataRange visit(OWLDataOneOf o) { return m_factory.getOWLDataComplementOf(o); }
public OWLClassExpression visit(OWLDataHasValue d) { OWLDataOneOf nominal=m_factory.getOWLDataOneOf(d.getValue()); return m_factory.getOWLDataSomeValuesFrom(d.getProperty(),nominal); }
public void visit(OWLDataOneOf object) { LiteralDataRange literalRange=m_dataRangeConverter.convertDataRange(object); m_headAtoms.add(Atom.create((DLPredicate)literalRange,X)); }
@Override public OWLDataOneOf visit(ElkDataOneOf expression) { return owlFactory_ .getOWLDataOneOf(toLiteralSet(expression.getLiterals())); }
@SuppressWarnings("static-method") public ElkDataOneOf convert(OWLDataOneOf owlDataOneOf) { return new ElkDataOneOfWrap<OWLDataOneOf>(owlDataOneOf); }
@Override public ElkDataOneOf visit(OWLDataOneOf owlDataOneOf) { return CONVERTER.convert(owlDataOneOf); }
@Override public O visit(OWLDataOneOf node) { return doDefault(node); }
@Override public void visit(OWLDataOneOf node) { handleDefault(node); }
@Override public void visit(OWLDataOneOf node) { type = DATA_TYPE_INDEX_BASE + 3; }
@Override public void visit(OWLDataOneOf node) { hashCode = primes[52]; hashCode = hashCode * MULT + node.getValues().hashCode(); }
@Override public void visit(@Nonnull OWLDataOneOf node) { for (OWLLiteral val : node.getValues()) { val.accept(this); } }
public Object visit(OWLDataOneOf node) { if (node.getValues().size() != 1) { profileViolations.add(new UseOfDataOneOfWithMultipleLiterals(getCurrentOntology(), getCurrentAxiom(), node)); } return null; }