Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDatatype


        if (!propId.equals("shorthand")) {
            clause.addValue(propId);
            if (annVal instanceof OWLLiteral) {
                OWLLiteral owlLiteral = (OWLLiteral) annVal;
                clause.addValue(owlLiteral.getLiteral());
                OWLDatatype datatype = owlLiteral.getDatatype();
                IRI dataTypeIri = datatype.getIRI();
                if (!OWL2Datatype.isBuiltIn(dataTypeIri)) {
                    error("Untranslatable axiom due to unknown data type: "
                            + annVal, true);
                    return false;
                }
View Full Code Here


        }
        throw new Error("Missing return statement in function");
    }

    final public OWLDatatype Datatype() throws ParseException {
        OWLDatatype dt;
        jj_consume_token(DATATYPE);
        jj_consume_token(OPENPAR);
        dt = DatatypeIRI();
        jj_consume_token(CLOSEPAR);
        {
View Full Code Here

        throw new Error("Missing return statement in function");
    }

    final public OWLDatatypeDefinitionAxiom DatatypeDefinitionAxiom()
            throws ParseException {
        OWLDatatype datatype;
        OWLDataRange dr;
        Set<OWLAnnotation> axAnnos;
        jj_consume_token(DATATYPEDEFINITION);
        jj_consume_token(OPENPAR);
        axAnnos = AxiomAnnotationSet();
View Full Code Here

        throw new Error("Missing return statement in function");
    }

    final public OWLDataRange DataRangeRestriction() throws ParseException {
        OWLFacet v;
        OWLDatatype rng;
        OWLFacetRestriction facetRestriction;
        Set<OWLFacetRestriction> facetRestrictions = new HashSet<OWLFacetRestriction>();
        jj_consume_token(DATATYPERESTRICTION);
        jj_consume_token(OPENPAR);
        rng = DatatypeIRI();
View Full Code Here

    //
    // //////////////////////////////////////////////////////////////////////////////////////////////////////////////
    final public OWLLiteral Literal() throws ParseException {
        boolean plain = true;
        String literal;
        OWLDatatype datatype = null;
        String lang = "";
        literal = QuotedString();
        switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
            case LANGIDENTIFIER:
            case DATATYPEIDENTIFIER: {
                switch (jj_ntk == -1 ? jj_ntk_f() : jj_ntk) {
                    case DATATYPEIDENTIFIER: {
                        jj_consume_token(DATATYPEIDENTIFIER);
                        plain = false;
                        datatype = DatatypeIRI();
                        break;
                    }
                    case LANGIDENTIFIER: {
                        jj_consume_token(LANGIDENTIFIER);
                        lang = LangTag();
                        break;
                    }
                    default:
                        jj_la1[41] = jj_gen;
                        jj_consume_token(-1);
                        throw new ParseException();
                }
                break;
            }
            default:
                jj_la1[42] = jj_gen;
                ;
        }
        if (plain) {
            {
                if ("" != null) {
                    return dataFactory.getOWLLiteral(literal, lang);
                }
            }
        } else {
            // a float value in this syntax has an extra 'f' or 'F' character
            // that must be removed to make a valid OWL literal
            if (datatype.isFloat()
                    && (literal.endsWith("f") || literal.endsWith("F"))
                    && !(literal.endsWith("inf") || literal.endsWith("INF"))) {
                literal = literal.substring(0, literal.length() - 1);
            }
            {
View Full Code Here

     *         datatype or a built-in datatype; {@code false} otherwise
     */
    protected static boolean isTopOrBuiltInDatatype(
            @Nonnull OWLDataRange dataRange) {
        if (dataRange.isDatatype()) {
            OWLDatatype dataType = dataRange.asOWLDatatype();
            return dataType.isTopDatatype() || dataType.isBuiltIn();
        } else {
            return false;
        }
    }
View Full Code Here

        return prop;
    }

    @Nonnull
    private OWLDatatype getOWLDatatype(@Nonnull String name) {
        OWLDatatype dt = owlEntityChecker.getOWLDatatype(name);
        if (dt == null && dataTypeNames.contains(name)) {
            dt = dataFactory.getOWLDatatype(getIRI(name));
        }
        if (dt == null) {
            throw new ExceptionBuilder().withDt().build();
View Full Code Here

    @Nonnull
    private OWLDataRange parseDataRangePrimary() {
        String tok = peekToken();
        if (isDatatypeName(tok)) {
            consumeToken();
            OWLDatatype datatype = getOWLDatatype(tok);
            String next = peekToken();
            if (OPENBRACKET.matches(next)) {
                // Restricted data range
                consumeToken();
                String sep = COMMA.keyword();
View Full Code Here

        Set<OntologyAxiomPair> axioms = new HashSet<>();
        if (!DATATYPE.matches(tok)) {
            throw new ExceptionBuilder().withKeyword(DATATYPE).build();
        }
        String subj = consumeToken();
        OWLDatatype datatype = getOWLDatatype(subj);
        axioms.add(new OntologyAxiomPair(defaultOntology, dataFactory
                .getOWLDeclarationAxiom(datatype)));
        while (true) {
            String sect = peekToken();
            if (EQUIVALENT_TO.matches(sect)) {
                potentialKeywords.clear();
                consumeToken();
                Set<OWLOntology> onts = getOntologies();
                Set<OWLDataRange> drs = parseDataRangeList();
                for (OWLOntology ont : onts) {
                    assert ont != null;
                    for (OWLDataRange dr : drs) {
                        assert dr != null;
                        axioms.add(new OntologyAxiomPair(ont, dataFactory
                                .getOWLDatatypeDefinitionAxiom(datatype, dr)));
                    }
                }
            } else if (ANNOTATIONS.matches(sect)) {
                potentialKeywords.clear();
                axioms.addAll(parseAnnotations(datatype.getIRI()));
            } else {
                break;
            }
        }
        return axioms;
View Full Code Here

    }

    @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

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.