Examples of OWLDatatype


Examples of org.semanticweb.owlapi.model.OWLDatatype

    }

    @Test
    public void shouldBuildDatatype() {
        // given
        OWLDatatype expected = df.getOWLDatatype(iri);
        BuilderDatatype builder = new BuilderDatatype(expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
        assertEquals(expected, built);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

    @Test
    public void testCorrectAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLClass clsA = Class(iri("A"));
        OWLDatatype dt = Datatype(iri("B"));
        OWLDataProperty propP = DataProperty(iri("p"));
        axioms.add(SubClassOf(clsA, DataSomeValuesFrom(propP, dt)));
        axioms.add(Declaration(dt));
        axioms.add(Declaration(propP));
        assertEquals(getOnt().getAxioms(), axioms);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

            return true;
        }
        if (!(obj instanceof OWLDatatype)) {
            return false;
        }
        OWLDatatype other = (OWLDatatype) obj;
        return owl2Datatype.getIRI().equals(other.getIRI());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

    public int compareTo(OWLObject o) {
        if (!(o instanceof OWLDatatype)) {
            OWLObjectTypeIndexProvider provider = new OWLObjectTypeIndexProvider();
            return provider.getTypeIndex(o);
        }
        OWLDatatype other = (OWLDatatype) o;
        return getIRI().compareTo(other.getIRI());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

        OWLDataFactory factory = manager.getOWLDataFactory();
        // OWLDatatype represents named datatypes in OWL. These are a bit like
        // classes whose instances are data values OWLDatatype objects are
        // obtained from a data factory. The OWL2Datatype enum defines built in
        // OWL 2 Datatypes Get hold of the integer datatype
        OWLDatatype integer = factory.getOWLDatatype(OWL2Datatype.XSD_INTEGER
                .getIRI());
        // For common data types there are some convenience methods of
        // OWLDataFactory. For example
        OWLDatatype integerDatatype = factory.getIntegerOWLDatatype();
        OWLDatatype floatDatatype = factory.getFloatOWLDatatype();
        OWLDatatype doubleDatatype = factory.getDoubleOWLDatatype();
        OWLDatatype booleanDatatype = factory.getBooleanOWLDatatype();
        // The top datatype (analgous to owl:Thing) is rdfs:Literal, which can
        // be obtained from the data factory
        OWLDatatype rdfsLiteral = factory.getTopDatatype();
        // Custom data ranges can be built up from these basic datatypes. For
        // example, it is possible to restrict a datatype using facets from XML
        // Schema Datatypes. For example, lets create a data range that
        // describes integers that are greater or equal to 18 To do this, we
        // restrict the xsd:integer datatype using the xsd:minInclusive facet
        // with a value of 18. Get hold of a literal that is an integer value 18
        OWLLiteral eighteen = factory.getOWLLiteral(18);
        // Now create the restriction. The OWLFacet enum provides an enumeration
        // of the various facets that can be used
        OWLDatatypeRestriction integerGE18 = factory.getOWLDatatypeRestriction(
                integer, MIN_INCLUSIVE, eighteen);
        // We could use this datatype in restriction, as the range of data
        // properties etc. For example, if we want to restrict the range of the
        // :hasAge data property to 18 or more we specify its range as this data
        // range
        PrefixManager pm = new DefaultPrefixManager(null, null,
                "http://www.semanticweb.org/ontologies/dataranges#");
        OWLDataProperty hasAge = factory.getOWLDataProperty(":hasAge", pm);
        OWLDataPropertyRangeAxiom rangeAxiom = factory
                .getOWLDataPropertyRangeAxiom(hasAge, integerGE18);
        OWLOntology ontology = manager.createOntology(IRI
                .create("http://www.semanticweb.org/ontologies/dataranges"));
        // Add the range axiom to our ontology
        manager.addAxiom(ontology, rangeAxiom);
        // For creating datatype restrictions on integers or doubles there are
        // some convenience methods on OWLDataFactory For example: Create a data
        // range of integers greater or equal to 60
        OWLDatatypeRestriction integerGE60 = factory
                .getOWLDatatypeMinInclusiveRestriction(60);
        // Create a data range of integers less than 16
        OWLDatatypeRestriction integerLT16 = factory
                .getOWLDatatypeMaxExclusiveRestriction(18);
        // In OWL 2 it is possible to represent the intersection, union and
        // complement of data types For example, we could create a union of data
        // ranges of the data range integer less than 16 or integer greater or
        // equal to 60
        OWLDataUnionOf concessionaryAge = factory.getOWLDataUnionOf(
                integerLT16, integerGE60);
        // We can also coin names for custom data ranges. To do this we use an
        // OWLDatatypeDefintionAxiom Get hold of a named datarange (datatype)
        // that will be used to assign a name to our above datatype
        OWLDatatype concessionaryAgeDatatype = factory.getOWLDatatype(
                ":ConcessionaryAge", pm);
        // Now create a datatype definition axiom
        OWLDatatypeDefinitionAxiom datatypeDef = factory
                .getOWLDatatypeDefinitionAxiom(concessionaryAgeDatatype,
                        concessionaryAge);
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

                .getOWLFunctionalDataPropertyAxiom(hasAge);
        man.applyChange(new AddAxiom(ont, funcAx));
        // Now create the data range which correponds to int greater than 18. To
        // do this, we get hold of the int datatype and then restrict it with a
        // minInclusive facet restriction.
        OWLDatatype intDatatype = factory.getIntegerOWLDatatype();
        // Create the value "18", which is an int.
        OWLLiteral eighteenConstant = factory.getOWLLiteral(18);
        // 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;
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

                new Object[] { withCaching });
    }

    @Test
    public void getRDFPlainLiteral() {
        OWLDatatype datatypeCall1 = dataFactory.getRDFPlainLiteral();
        OWLDatatype datatypeCall2 = dataFactory.getRDFPlainLiteral();
        assertSame(datatypeCall1, datatypeCall2);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

        assertSame(datatypeCall1, datatypeCall2);
    }

    @Test
    public void getTopDatatype() {
        OWLDatatype datatypeCall1 = dataFactory.getTopDatatype();
        OWLDatatype datatypeCall2 = dataFactory.getTopDatatype();
        assertSame(datatypeCall1, datatypeCall2);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

        OWLLiteral literal1 = factory.getOWLLiteral("My string literal", "");
        // Get an untyped string literal with a language tag
        OWLLiteral literal2 = factory.getOWLLiteral("My string literal", "en");
        // Typed literals are literals that are typed with a datatype Create a
        // typed literal to represent the integer 33
        OWLDatatype integerDatatype = factory
                .getOWLDatatype(OWL2Datatype.XSD_INTEGER.getIRI());
        OWLLiteral literal3 = factory.getOWLLiteral("33", integerDatatype);
        // There is are short cut methods on OWLDataFactory for creating typed
        // literals with common datatypes Internallym these methods create
        // literals as above Create a literal to represent the integer 33
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLDatatype

        assertSame(datatypeCall1, datatypeCall2);
    }

    @Test
    public void getBooleanDatatype() {
        OWLDatatype datatypeCall1 = dataFactory.getBooleanOWLDatatype();
        OWLDatatype datatypeCall2 = dataFactory.getBooleanOWLDatatype();
        assertSame(datatypeCall1, datatypeCall2);
    }
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.