Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDatatype


     *
     * @param l
     * @return
     */
    private Literal getLiteral(OWLLiteral l) {
        OWLDatatype dt = l.getDatatype();
        String literal = l.getLiteral();
       
        Literal res = null;
       
        if(dt.isBuiltIn()) {
            OWL2Datatype odt = dt.getBuiltInDatatype();
            switch (odt) {
                case RDF_PLAIN_LITERAL:
                case RDF_XML_LITERAL:
                case XSD_STRING:
                case XSD_NORMALIZED_STRING:
View Full Code Here


        for (OWLDataPropertyRangeAxiom a : dprAxioms) {
            OWLDataPropertyExpression pe = a.getProperty();
            OWLDataRange r = a.getRange();
            // TODO: check DataOneOf
            // TODO: check OWLDataIntersectionOf
            OWLDatatype otype = r.asOWLDatatype();

            if (!pe.isAnonymous()) {
                if (!otype.equals(type)) {
                    problems.add("The literal value restriction " + dp + " is inconsistent with the data property " +
                        "range axiom " + a);
                }
            } else {
                problems.add("Found anonymous data property expression in data property range axiom: " + pe);
View Full Code Here

            public void visit(OWLDataHasValue e) {
                OWLDataPropertyExpression dpe = e.getProperty();
                // TODO: consider the case where dpe is anonymous
                OWLDataProperty dp = dpe.asOWLDataProperty();
                OWLLiteral l = e.getValue();
                OWLDatatype type = l.getDatatype();

                checkInconsistentProperty(dp, type);

                NamedFeature f = new NamedFeature(dp.toStringID());
                Literal lit = getLiteral(l);
                if(lit != null) {
                    push(new Datatype(f, Operator.EQUALS,lit));
                } else {
                    problems.add("Axiom " + e + " will be ignored because of the unsupported literal.");
                }
            }

            public void visit(OWLDataAllValuesFrom e) {
                unimplemented(e);
            }

            public void visit(OWLDataSomeValuesFrom e) {
                OWLDataProperty dp = e.getProperty().asOWLDataProperty();
                OWLDataRange range = e.getFiller();
               
                /*
                 * An OWLDataRange can be one of the following:
                 * Datatype | DataIntersectionOf | DataUnionOf |
                 * DataComplementOf | DataOneOf | DatatypeRestriction
                 *
                 * We initially support only DataOneOf.
                 */
                if(range instanceof OWLDataOneOf) {
                    OWLDataOneOf doo = (OWLDataOneOf)range;
                    Set<OWLLiteral> values = doo.getValues();
                    if(values.size() != 1) {
                        problems.add("Expected only a single literal in "+e);
                        return;
                    }
                    OWLLiteral l = (OWLLiteral)values.toArray()[0];
                    OWLDatatype type = l.getDatatype();
                    checkInconsistentProperty(dp, type);
                   
                    NamedFeature f = new NamedFeature(dp.toStringID());
                    Literal lit = getLiteral(l);
                    if(lit != null) {
View Full Code Here

        OWLClass cls = factory.getOWLClass(IRI.create(CLAZZ));
        OWLDataProperty dp = factory.getOWLDataProperty(IRI.create(DP));
        OWLObjectProperty op = factory.getOWLObjectProperty(IRI.create(OP));
        OWLAnnotationProperty oa = factory.getOWLAnnotationProperty(IRI.create(label));
        OWLAnnotation oav = factory.getOWLAnnotation(oa, factory.getOWLStringLiteral(clazzlabel, "en"));
        OWLDatatype dt = factory.getOWLDatatype(IRI.create(DATATYPE));
        OWLNamedIndividual sub = factory.getOWLNamedIndividual(IRI.create(SUBJECT));
        OWLNamedIndividual obj = factory.getOWLNamedIndividual(IRI.create(OBJECT));
        OWLLiteral literal1 = factory.getOWLTypedLiteral(VALUE, dt);
        OWLDeclarationAxiom daxiomcls = factory.getOWLDeclarationAxiom(cls); // Classe
        OWLDeclarationAxiom daxiomop = factory.getOWLDeclarationAxiom(op); // obj prop
View Full Code Here

        OWLClass cls = factory.getOWLClass(IRI.create(CLAZZ));
        OWLDataProperty dp = factory.getOWLDataProperty(IRI.create(DP));
        OWLObjectProperty op = factory.getOWLObjectProperty(IRI.create(OP));
        OWLAnnotationProperty oa = factory.getOWLAnnotationProperty(IRI.create(label));
        OWLAnnotation oav = factory.getOWLAnnotation(oa, factory.getOWLStringLiteral(clazzlabel, "en"));
        OWLDatatype dt = factory.getOWLDatatype(IRI.create(DATATYPE));
        OWLNamedIndividual sub = factory.getOWLNamedIndividual(IRI.create(SUBJECT));
        OWLNamedIndividual obj = factory.getOWLNamedIndividual(IRI.create(OBJECT));
        OWLLiteral literal1 = factory.getOWLTypedLiteral(VALUE, dt);
        OWLDeclarationAxiom daxiomcls = factory.getOWLDeclarationAxiom(cls); // Classe
        OWLDeclarationAxiom daxiomop = factory.getOWLDeclarationAxiom(op); // obj prop
View Full Code Here

                    manager.addAxiom(ontology, annotations.next());
            }

            // If the entity is a data type
            if (entity.isOWLDatatype()) {
                OWLDatatype owldata = entity.asOWLDatatype();

                Iterator<OWLDatatypeDefinitionAxiom> entityaxiom = owlmodel.getAxioms(owldata).iterator();

                while (entityaxiom.hasNext())
                    manager.addAxiom(ontology, entityaxiom.next());
View Full Code Here

            }
        }
    }

    private void translateEquivalentDataRanges(IRI subject, IRI predicate, IRI object) {
        OWLDatatype datatype = getDataFactory().getOWLDatatype(subject);
        OWLDataRange dataRange = getConsumer().translateDataRange(object);
        addAxiom(getDataFactory().getOWLDatatypeDefinitionAxiom(datatype, dataRange, getPendingAnnotations()));
        consumeTriple(subject, predicate, object);
    }
View Full Code Here

    public static <N extends Number> OWLDataRange getMaxExclusiveRestrictedInteger(OWLDataFactory dataFactory, N maxExclusive) {
        return dataFactory.getOWLDatatypeRestriction(getDatatype(dataFactory, maxExclusive), getFacetRestrictionSet(dataFactory, OWLFacet.MAX_EXCLUSIVE, getTypedConstant(dataFactory, maxExclusive)));
    }

    public static <N extends Number> OWLDataRange getMinMaxInclusiveRestrictedInteger(OWLDataFactory dataFactory, N minInclusive, N maxInclusive) {
        OWLDatatype dr = getDatatype(dataFactory, minInclusive);
        Set<OWLFacetRestriction> facetRestrictions = new HashSet<OWLFacetRestriction>();
        facetRestrictions.add(dataFactory.getOWLFacetRestriction(OWLFacet.MIN_INCLUSIVE, getTypedConstant(dataFactory, minInclusive)));
        facetRestrictions.add(dataFactory.getOWLFacetRestriction(OWLFacet.MAX_INCLUSIVE, getTypedConstant(dataFactory, maxInclusive)));

        return dataFactory.getOWLDatatypeRestriction(dr, facetRestrictions);
View Full Code Here

        return dataFactory.getOWLDatatypeRestriction(dr, facetRestrictions);
    }

    public static <N extends Number> OWLDataRange getMinMaxExclusiveRestrictedInteger(OWLDataFactory dataFactory, N minExclusive, N maxExclusive) {
        OWLDatatype dr = getDatatype(dataFactory, minExclusive);
        Set<OWLFacetRestriction> facetRestrictions = new HashSet<OWLFacetRestriction>();
        facetRestrictions.add(dataFactory.getOWLFacetRestriction(OWLFacet.MIN_EXCLUSIVE, getTypedConstant(dataFactory, minExclusive)));
        facetRestrictions.add(dataFactory.getOWLFacetRestriction(OWLFacet.MAX_EXCLUSIVE, getTypedConstant(dataFactory, maxExclusive)));

        return dataFactory.getOWLDatatypeRestriction(dr, facetRestrictions);
View Full Code Here

            if (isAnonymousNode(onDatatypeObject)) {
                // TODO LOG ERROR
                return dataFactory.getOWLDatatype(mainNode);
            }
            OWLDatatype restrictedDataRange = (OWLDatatype) translateDataRange(onDatatypeObject);

            // Now we have to get the restricted facets - there is some legacy translation code here... the current
            // spec uses a list of triples where the predicate is a facet and the object a literal that is restricted
            // by the facet.  Originally, there just used to be multiple facet-"facet value" triples
            Set<OWLFacetRestriction> restrictions = new HashSet<OWLFacetRestriction>();
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.