Examples of OWLLiteral


Examples of org.semanticweb.owlapi.model.OWLLiteral

public class LiteralTestCase extends AbstractAxiomsRoundTrippingTestCase {

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        OWLLiteral literalWithLang = Literal("abc", "en");
        OWLClass cls = Class(iri("A"));
        OWLAnnotationProperty prop = AnnotationProperty(iri("prop"));
        OWLAnnotationAssertionAxiom ax = AnnotationAssertion(prop,
                cls.getIRI(), literalWithLang);
        Set<OWLAxiom> axioms = new HashSet<>();
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        return axioms;
    }

    @Test
    public void testHasLangMethod() {
        OWLLiteral literalWithLang = Literal("abc", "en");
        assertTrue(literalWithLang.hasLang());
        OWLLiteral literalWithoutLang = Literal("abc", "");
        assertFalse(literalWithoutLang.hasLang());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertFalse(literalWithoutLang.hasLang());
    }

    @Test
    public void testGetLangMethod() {
        OWLLiteral literalWithLang = Literal("abc", "en");
        assertEquals("en", literalWithLang.getLang());
        OWLLiteral literalWithoutLang = Literal("abc", "");
        assertEquals("", literalWithoutLang.getLang());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertEquals("", literalWithoutLang.getLang());
    }

    @Test
    public void testNormalisation() {
        OWLLiteral literalWithLang = Literal("abc", "EN");
        assertEquals("en", literalWithLang.getLang());
        assertTrue(literalWithLang.hasLang("EN"));
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertTrue(literalWithLang.hasLang("EN"));
    }

    @Test
    public void testPlainLiteralWithLang() {
        OWLLiteral literalWithLang = Literal("abc", "en");
        assertTrue(literalWithLang.getDatatype().getIRI().isPlainLiteral());
        assertTrue(literalWithLang.isRDFPlainLiteral());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertTrue(literalWithLang.isRDFPlainLiteral());
    }

    @Test
    public void testPlainLiteralWithEmbeddedLang() {
        OWLLiteral literal = Literal("abc@en", PlainLiteral());
        assertTrue(literal.hasLang());
        assertEquals("en", literal.getLang());
        assertEquals("abc", literal.getLiteral());
        assertEquals(literal.getDatatype(), PlainLiteral());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertEquals("abc", literal.getLiteral());
        assertEquals(literal.getDatatype(), PlainLiteral());
    }

    public void tesPlainLiteralWithEmbeddedEmptyLang() {
        OWLLiteral literal = Literal("abc@", PlainLiteral());
        assertFalse(literal.hasLang());
        assertEquals("", literal.getLang());
        assertEquals("abc", literal.getLiteral());
        assertEquals(literal.getDatatype(), PlainLiteral());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertEquals("abc", literal.getLiteral());
        assertEquals(literal.getDatatype(), PlainLiteral());
    }

    public void tesPlainLiteralWithDoubleSep() {
        OWLLiteral literal = Literal("abc@@en", PlainLiteral());
        assertEquals("en", literal.getLang());
        assertEquals("abc@", literal.getLiteral());
        assertEquals(literal.getDatatype(), PlainLiteral());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        assertEquals(literal.getDatatype(), PlainLiteral());
    }

    @Test
    public void testBoolean() {
        OWLLiteral literal = Literal(true);
        assertTrue(literal.isBoolean());
        assertTrue(literal.parseBoolean());
        OWLLiteral trueLiteral = Literal("true", OWL2Datatype.XSD_BOOLEAN);
        assertTrue(trueLiteral.isBoolean());
        assertTrue(trueLiteral.parseBoolean());
        OWLLiteral falseLiteral = Literal("false", OWL2Datatype.XSD_BOOLEAN);
        assertTrue(falseLiteral.isBoolean());
        assertFalse(falseLiteral.parseBoolean());
        OWLLiteral oneLiteral = Literal("1", OWL2Datatype.XSD_BOOLEAN);
        assertTrue(oneLiteral.isBoolean());
        assertTrue(oneLiteral.parseBoolean());
        OWLLiteral zeroLiteral = Literal("0", OWL2Datatype.XSD_BOOLEAN);
        assertTrue(zeroLiteral.isBoolean());
        assertFalse(zeroLiteral.parseBoolean());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.OWLLiteral

        // 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
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.