Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDatatype


    public void
            shouldCreateViolationForOWLDatatypeDefinitionAxiomInOWL2RLProfile()
                    throws Exception {
        OWLOntology o = createOnto();
        OWLOntologyManager m = o.getOWLOntologyManager();
        OWLDatatype datatype = Datatype(IRI("urn:test#datatype"));
        declare(o, datatype);
        m.addAxiom(o, DatatypeDefinition(datatype, Boolean()));
        OWL2RLProfile profile = new OWL2RLProfile();
        int expected = 2;
        Class[] expectedViolations = { UseOfIllegalAxiom.class,
View Full Code Here


        // Data ranges are used as the types of literals, as the ranges for data
        // properties
        OWLOntologyManager m = create();
        // OWLDatatype represents named datatypes in OWL
        // The OWL2Datatype enum defines built in OWL 2 Datatypes
        OWLDatatype integer = df.getOWLDatatype(OWL2Datatype.XSD_INTEGER
                .getIRI());
        // For common data types there are some convenience methods of
        // OWLDataFactory
        OWLDatatype integerDatatype = df.getIntegerOWLDatatype();
        OWLDatatype floatDatatype = df.getFloatOWLDatatype();
        OWLDatatype doubleDatatype = df.getDoubleOWLDatatype();
        OWLDatatype booleanDatatype = df.getBooleanOWLDatatype();
        // The top datatype is rdfs:Literal
        OWLDatatype rdfsLiteral = df.getTopDatatype();
        // Custom data ranges can be built up from these basic datatypes
        // Get hold of a literal that is an integer value 18
        OWLLiteral eighteen = df.getOWLLiteral(18);
        OWLDatatypeRestriction integerGE18 = df.getOWLDatatypeRestriction(
                integer, OWLFacet.MIN_INCLUSIVE, eighteen);
View Full Code Here

            OWLLiteral literal = consumer.getLiteralObject(mainNode, predicate,
                    false);
            if (literal == null) {
                return false;
            }
            OWLDatatype datatype = literal.getDatatype();
            OWL2Datatype nni = OWL2Datatype.XSD_NON_NEGATIVE_INTEGER;
            return datatype.getIRI().equals(nni.getIRI())
                    && nni.isInLexicalSpace(literal.getLiteral());
        }
View Full Code Here

        axioms.removeAll(toRemove);
        return true;
    }

    private Set<OWLAnnotation> reannotate(Set<OWLAnnotation> anns) {
        OWLDatatype stringType = df.getOWLDatatype(OWL2Datatype.XSD_STRING
                .getIRI());
        Set<OWLAnnotation> toReturn = new HashSet<>();
        for (OWLAnnotation a : anns) {
            Optional<OWLLiteral> asLiteral = a.getValue().asLiteral();
            if (asLiteral.isPresent() && asLiteral.get().isRDFPlainLiteral()) {
View Full Code Here

    @Test
    public void shouldParseCorrectlydecimal()
            throws OWLOntologyCreationException {
        // given
        String text1 = "p some decimal[<=2.0, >= 1.0]";
        OWLDatatype decimal = df.getOWLDatatype(OWL2Datatype.XSD_DECIMAL
                .getIRI());
        OWLFacetRestriction max = df.getOWLFacetRestriction(
                OWLFacet.MAX_INCLUSIVE, df.getOWLLiteral("2.0", decimal));
        OWLFacetRestriction min = df.getOWLFacetRestriction(
                OWLFacet.MIN_INCLUSIVE, df.getOWLLiteral("1.0", decimal));
View Full Code Here

    public void testDatatypeAccessor() {
        OWLOntology ont = getOWLOntology("ontology");
        OWLAnnotationAssertionAxiom ax = createAnnotationAssertionAxiom();
        ont.getOWLOntologyManager().addAxiom(ont, ax);
        assertTrue(ont.getAnnotationAssertionAxioms(SUBJECT).contains(ax));
        OWLDatatype cls = Datatype(SUBJECT);
        Set<OWLAnnotationAssertionAxiom> axioms = ont
                .getAnnotationAssertionAxioms(cls.getIRI());
        assertTrue(axioms.contains(ax));
        assertTrue(annotations(axioms).contains(ax.getAnnotation()));
    }
View Full Code Here

    }

    @Test
    public void testIntegerRange() {
        String expected = "2147483648";
        OWLDatatype type = df.getIntegerOWLDatatype();
        OWLLiteral lit = df.getOWLLiteral(expected, type);
        assertEquals(expected, lit.getLiteral());
    }
View Full Code Here

        assertEquals(expected, lit.getLiteral());
    }

    @Test
    public void testEnumInt() {
        OWLDatatype type = df.getIntegerOWLDatatype();
        df.getOWLLiteral("1000000000000000000000000000000000000000", type);
    }
View Full Code Here

        df.getOWLLiteral("1000000000000000000000000000000000000000", type);
    }

    @Test
    public void testGetDataPropertyValues() {
        OWLDatatype type = df.getIntegerOWLDatatype();
        OWLLiteral lit1 = df.getOWLLiteral("01", type);
        OWLLiteral lit2 = df.getOWLLiteral("1", type);
        assertFalse(lit1.equals(lit2));
    }
View Full Code Here

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        OWLDatatype datatype = Datatype(IRI("http://www.ont.com/myont/mydatatype"));
        OWLDataRange dr = DataComplementOf(Integer());
        axioms.add(DatatypeDefinition(datatype, dr));
        axioms.add(Declaration(datatype));
        return axioms;
    }
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLDatatype

Copyright © 2018 www.massapicom. 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.