Examples of OWLDataRange


Examples of org.semanticweb.owlapi.model.OWLDataRange

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDataProperty prop = DataProperty(iri("prop"));
        OWLDataRange dr = Integer();
        OWLClass base = Class(iri("A"));
        axioms.add(SubClassOf(base, DataMinCardinality(3, prop, dr)));
        return axioms;
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDataProperty prop = DataProperty(iri("prop"));
        OWLDataRange dr = Integer();
        OWLClass base = Class(iri("A"));
        axioms.add(SubClassOf(base, DataExactCardinality(3, prop, dr)));
        return axioms;
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

        AbstractFileRoundTrippingTestCase {

    @Test
    public void testCorrectAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDataRange intdr = df.getIntegerOWLDatatype();
        OWLDataRange floatdr = df.getFloatOWLDatatype();
        OWLDataRange intersection = df.getOWLDataIntersectionOf(intdr, floatdr);
        OWLDataProperty p = DataProperty(iri("p"));
        OWLDataPropertyRangeAxiom ax = df.getOWLDataPropertyRangeAxiom(p,
                intersection);
        axioms.add(ax);
        axioms.add(Declaration(p));
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

        // Now create our custom datarange, which is int greater than or equal
        // to 18. To do this, we need the minInclusive facet
        OWLFacet facet = MIN_INCLUSIVE;
        // Create the restricted data range by applying the facet restriction
        // with a value of 18 to int
        OWLDataRange intGreaterThan18 = factory.getOWLDatatypeRestriction(
                intDatatype, facet, eighteenConstant);
        // Now we can use this in our datatype restriction on hasAge
        OWLClassExpression thingsWithAgeGreaterOrEqualTo18 = factory
                .getOWLDataSomeValuesFrom(hasAge, intGreaterThan18);
        // Now we want to say all adults have an age that is greater or equal to
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

        // convenience methods to do this
        OWLFacetRestriction lt20 = factory.getOWLFacetRestriction(
                MAX_EXCLUSIVE, 20);
        // Restrict the base type, integer (which is just an XML Schema
        // Datatype) with the facet restrictions.
        OWLDataRange dataRng = factory.getOWLDatatypeRestriction(
                integerDatatype, geq13, lt20);
        // Now we have the data range of greater than equal to 13 and less than
        // 20 we can use this in a restriction.
        OWLDataSomeValuesFrom teenagerAgeRestriction = factory
                .getOWLDataSomeValuesFrom(hasAge, dataRng);
        // Now make Teenager equivalent to Person and hasAge some int[>=13, <20]
        // First create the class Person and hasAge some int[>=13, <20]
        OWLClassExpression teenagePerson = factory.getOWLObjectIntersectionOf(
                person, teenagerAgeRestriction);
        OWLClass teenager = factory.getOWLClass(IRI.create(ontologyIRI
                + "#Teenager"));
        OWLEquivalentClassesAxiom teenagerDefinition = factory
                .getOWLEquivalentClassesAxiom(teenager, teenagePerson);
        manager.addAxiom(ont, teenagerDefinition);
        // Do the same for Adult that has an age greater than 21
        OWLDataRange geq21 = factory.getOWLDatatypeRestriction(integerDatatype,
                factory.getOWLFacetRestriction(MIN_INCLUSIVE, 21));
        OWLClass adult = factory
                .getOWLClass(IRI.create(ontologyIRI + "#Adult"));
        OWLClassExpression adultAgeRestriction = factory
                .getOWLDataSomeValuesFrom(hasAge, geq21);
        OWLClassExpression adultPerson = factory.getOWLObjectIntersectionOf(
                person, adultAgeRestriction);
        OWLAxiom adultDefinition = factory.getOWLEquivalentClassesAxiom(adult,
                adultPerson);
        manager.addAxiom(ont, adultDefinition);
        // And finally Child
        OWLDataRange notGeq21 = factory.getOWLDataComplementOf(geq21);
        OWLClass child = factory
                .getOWLClass(IRI.create(ontologyIRI + "#Child"));
        OWLClassExpression childAgeRestriction = factory
                .getOWLDataSomeValuesFrom(hasAge, notGeq21);
        OWLClassExpression childPerson = factory.getOWLObjectIntersectionOf(
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

public class DataOneOfTestCase extends AbstractFileRoundTrippingTestCase {

    @Test
    public void testCorrectAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDataRange oneOf = DataOneOf(Literal(30), Literal(31f));
        OWLDataProperty p = DataProperty(iri("p"));
        OWLDataPropertyRangeAxiom ax = DataPropertyRange(p, oneOf);
        axioms.add(ax);
        axioms.add(Declaration(p));
        assertEquals(getOnt().getAxioms(), axioms);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

        AbstractFileRoundTrippingTestCase {

    @Test
    public void testCorrectAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDataRange dr = DatatypeRestriction(Integer(),
                FacetRestriction(OWLFacet.MIN_INCLUSIVE, Literal(18)),
                FacetRestriction(OWLFacet.MAX_INCLUSIVE, Literal(30)));
        OWLDataProperty p = DataProperty(iri("p"));
        OWLDataPropertyRangeAxiom ax = DataPropertyRange(p, dr);
        axioms.add(ax);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

                if (dataRangeIRI == null) {
                    throw new OWLRuntimeException(
                            "Don't know how to translate SWRL Atom: data range IRI is null "
                                    + firstObject);
                }
                OWLDataRange dataRange = consumer
                        .translateDataRange(dataRangeIRI);
                return dataFactory.getSWRLDataRangeAtom(dataRange, dObject);
            } else if (consumer.isSWRLDataValuedPropertyAtom(firstObject)) {
                SWRLIArgument arg1 = translateSWRLAtomIObject(firstObject,
                        ARGUMENT_1.getIRI());
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        OWLDatatype dt = Datatype(IRI("file:/c/test.owlapi#SSN"));
        OWLFacetRestriction fr = FacetRestriction(OWLFacet.PATTERN,
                Literal("[0-9]{3}-[0-9]{2}-[0-9]{4}"));
        OWLDataRange dr = DatatypeRestriction(
                Datatype(IRI("http://www.w3.org/2001/XMLSchema#string")), fr);
        OWLDataIntersectionOf disj1 = DataIntersectionOf(DataComplementOf(dr),
                dt);
        // here I negate dr
        OWLDataIntersectionOf disj2 = DataIntersectionOf(DataComplementOf(dt),
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDataRange

    public void testRenameDatatype() {
        OWLOntology ont = getOWLOntology("testont");
        OWLDatatype dtA = Datatype(iri("DtA"));
        OWLDatatype dtB = Datatype(iri("DtB"));
        OWLDatatype dtC = Datatype(iri("DtC"));
        OWLDataRange rng1 = DataIntersectionOf(dtA, dtB);
        OWLDataRange rng1R = DataIntersectionOf(dtC, dtB);
        OWLDataRange rng2 = DataUnionOf(dtA, dtB);
        OWLDataRange rng2R = DataUnionOf(dtC, dtB);
        OWLDataRange rng3 = DataComplementOf(dtA);
        OWLDataRange rng3R = DataComplementOf(dtC);
        OWLDataPropertyExpression propB = DataProperty(iri("propA"));
        Set<OWLAxiom> axioms1 = new HashSet<>();
        axioms1.add(DataPropertyRange(propB, rng1));
        axioms1.add(DataPropertyRange(propB, rng2));
        axioms1.add(DataPropertyRange(propB, rng3));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.