Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDataRange


            return m_factory.getOWLDataIntersectionOf(newConjuncts);
        }
        public OWLDataRange visit(OWLDataUnionOf range) {
            Set<OWLDataRange> newDisjuncts=new HashSet<OWLDataRange>();
            for (OWLDataRange dr : range.getOperands()) {
                OWLDataRange drSimplified=getSimplified(dr);
                if (drSimplified.isTopDatatype())
                    return m_factory.getTopDatatype();
                else if (drSimplified instanceof OWLDataUnionOf)
                    newDisjuncts.addAll(((OWLDataUnionOf)drSimplified).getOperands());
                else
                    newDisjuncts.add(drSimplified);
View Full Code Here


            return true;
        if (reasoner.m_dlOntology.hasDatatypes()) {
            OWLDataFactory factory=reasoner.getDataFactory();
            OWLIndividual freshIndividual=factory.getOWLAnonymousIndividual("fresh-individual");
            OWLDataProperty freshDataProperty=factory.getOWLDataProperty(IRI.create("fresh-data-property"));
            OWLDataRange dataRange=axiom.getDataRange();
            OWLDatatype dt=axiom.getDatatype();
            OWLDataIntersectionOf dr1=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dataRange),dt);
            OWLDataIntersectionOf dr2=factory.getOWLDataIntersectionOf(factory.getOWLDataComplementOf(dt),dataRange);
            OWLDataUnionOf union=factory.getOWLDataUnionOf(dr1,dr2);
            OWLClassExpression c=factory.getOWLDataSomeValuesFrom(freshDataProperty,union);
View Full Code Here

            throw new IllegalStateException("Internal error: Invalid normal form.");
        }
        public void visit(OWLDataMinCardinality object) {
            if (!object.getProperty().isOWLBottomDataProperty() || object.getCardinality()==0) {
                OWLDataProperty dp=object.getProperty().asOWLDataProperty();
                OWLDataRange dr=object.getFiller();
                int n=object.getCardinality();

                if (m_dps2ranges.containsKey(dp)) {
                    String dt=m_dps2ranges.get(dp).getIRI().toString();
                    if (dt2maxRangeCardinality.containsKey(dt) && n>dt2maxRangeCardinality.get(dt))
                        return;
                }
                if (dr.isDatatype()) {
                    String dt=dr.asOWLDatatype().getIRI().toString();
                    if (dt2maxRangeCardinality.containsKey(dt) && n>dt2maxRangeCardinality.get(dt))
                        return;
                }
                AtomicRole atomicRole=getAtomicRole(object.getProperty());
                LiteralConcept literalConcept=m_dataRangeConverter.convertDataRange(object.getFiller());
View Full Code Here

        }
        public void visit(OWLDataUnionOf dr) {
            throw new IllegalStateException("Internal error: invalid normal form.");
        }
        public void visit(OWLDataComplementOf dr) {
            OWLDataRange description=dr.getDataRange();
            if (description.isDatatype() && (Prefixes.isInternalIRI(description.asOWLDatatype().getIRI().toString()) || m_definedDatatypeIRIs.contains(description.asOWLDatatype()))) {
                m_bodyAtoms.add(Atom.create(AtomicConcept.create(description.asOWLDatatype().getIRI().toString()),X));
            }
            else {
                LiteralConcept literalConcept=m_dataRangeConverter.convertDataRange(dr);
                if (literalConcept instanceof AtomicNegationConcept) {
                    AtomicConcept negatedConcept=((AtomicNegationConcept)literalConcept).getNegatedAtomicConcept();
View Full Code Here

        setDataRange(getOWLDataFactory().getOWLDatatypeRestriction(restrictedDataRange, facetRestrictions));
    }


    public void handleChild(AbstractOWLDataRangeHandler handler) {
        OWLDataRange dr = handler.getOWLObject();
        if (dr.isDatatype()) {
            restrictedDataRange = dr.asOWLDatatype();
        }
    }
View Full Code Here

    public OWLDatatypeDefinitionElementHandler(OWLXMLParserHandler handler) {
        super(handler);
    }

    public void handleChild(AbstractOWLDataRangeHandler handler) throws OWLXMLParserException {
        OWLDataRange handledDataRange = handler.getOWLObject();
        if(handledDataRange.isDatatype() && datatype == null) {
            datatype = handledDataRange.asOWLDatatype();
        }
        else {
            dataRange = handledDataRange;
        }
    }
View Full Code Here

    }
   
    private void checkInconsistentProperty(OWLDataProperty dp, OWLDatatype type) {
        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);
View Full Code Here

                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) {
                        push(new Datatype(f, Operator.EQUALS, lit));
                    } else {
                        problems.add("Axiom " + e + " will be ignored because of the unsupported literal.");
                    }
                } else if(range instanceof OWLDatatypeRestriction) {
                    NamedFeature f = new NamedFeature(dp.toStringID());
                   
                    OWLDatatypeRestriction dtr = (OWLDatatypeRestriction)range;
                    Set<OWLFacetRestriction> frs = dtr.getFacetRestrictions();
                   
                    List<Datatype> conjuncts = new ArrayList<Datatype>();
                    for(OWLFacetRestriction fr : frs) {
                        OWLLiteral l = fr.getFacetValue();
                       
                        Literal lit = getLiteral(l);
                       
                        if(lit != null) {
                            checkInconsistentProperty(dp, l.getDatatype());
                            OWLFacet facet = fr.getFacet();
                           
                            switch(facet) {
                                case MAX_EXCLUSIVE:
                                    conjuncts.add(new Datatype(f, Operator.LESS_THAN, lit));
                                    break;
                                case MAX_INCLUSIVE:
                                    conjuncts.add(new Datatype(f, Operator.LESS_THAN_EQUALS, lit));
                                    break;
                                case MIN_EXCLUSIVE:
                                    conjuncts.add(new Datatype(f, Operator.GREATER_THAN, lit));
                                    break;
                                case MIN_INCLUSIVE:
                                    conjuncts.add(new Datatype(f, Operator.GREATER_THAN_EQUALS, lit));
                                    break;
                                default:
                                    throw new RuntimeException("Unsupported facet "+facet)
                            }
                        } else {
                            problems.add("Axiom " + e + " will be ignored because of the unsupported literal.");
                        }
                    }
                   
                    // Create conjunctions with all restrictions
                    if(conjuncts.size() == 1) {
                        push(conjuncts.get(0));
                    } else if(!conjuncts.isEmpty()){
                        push(new Conjunction(conjuncts));
                    }
                } else {
                    throw new RuntimeException("Unsupporter OWLDataRange: "+
                            range.getClass().getName());
                }
            }

            public void visit(OWLObjectOneOf e) {
                // TODO: implement to support EL profile
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

        IRI complementOfObject = getResourceObject(mainNode, OWL_DATATYPE_COMPLEMENT_OF, true);
        if (!configuration.isStrict() && complementOfObject == null) {
            complementOfObject = getResourceObject(mainNode, OWL_COMPLEMENT_OF, true);
        }
        if (complementOfObject != null) {
            OWLDataRange operand = translateDataRange(complementOfObject);
            return dataFactory.getOWLDataComplementOf(operand);
        }


        IRI oneOfObject = getResourceObject(mainNode, OWL_ONE_OF, true);
View Full Code Here

TOP

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

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.