Package org.semanticweb.owl.model

Examples of org.semanticweb.owl.model.OWLConstant


        OWLAxiom ax = null;
        if (objectTripleObject != null) {
            ax = handleAxiomTriples(subjectTripleObject, predicateTripleObject, objectTripleObject);
        }
        else {
            OWLConstant con = getConsumer().getLiteralObject(subject, OWLRDFVocabulary.RDF_OBJECT.getURI(), true);
            if (con == null) {
                throw new OWLRDFXMLParserMalformedNodeException("missing owl:object triple.");
            }
            ax = handleAxiomTriples(subjectTripleObject, predicateTripleObject, con);
        }
View Full Code Here


        if(handler.getOWLObject().isTyped()) {
            constants.add((OWLTypedConstant) handler.getOWLObject());
        }
        else {
            // Type as string?
            OWLConstant currentConstant = handler.getOWLObject();
            constants.add(getOWLDataFactory().getOWLTypedConstant(currentConstant.getLiteral(), getOWLDataFactory().getOWLDataType(XSDVocabulary.STRING.getURI())));
        }
    }
View Full Code Here

        URI firstResource = getConsumer().getFirstResource(mainNode, true);
        if (firstResource != null) {
            list.add(translator.translate(firstResource));
        }
        else {
            OWLConstant constant = getConsumer().getFirstLiteral(mainNode);
            if (constant != null) {
                list.add(translator.translate(constant));
            }
            else {
                // Empty list?
View Full Code Here

     * @param mainNode The main node of the restriction.
     * @return The cardinality of the restriction.
     * @throws OWLException
     */
    private int translateCardinality(URI mainNode) throws OWLException {
        OWLConstant con = getLiteralObject(mainNode, getCardinalityTriplePredicate(), true);
        if(con == null) {
            throw new MalformedDescriptionException(getCardinalityTriplePredicate() + " not present");
        }
        return Integer.parseInt(con.getLiteral());
    }
View Full Code Here

        super(consumer);
    }


    protected OWLDescription translateRestriction(URI mainNode) throws OWLException {
        OWLConstant con = getLiteralObject(mainNode, OWLRDFVocabulary.OWL_HAS_VALUE.getURI(), true);
        if (con == null) {
            throw new MalformedDescriptionException(OWLRDFVocabulary.OWL_HAS_VALUE.getURI() + " triple is not present");
        }
        return getDataFactory().getOWLDataValueRestriction(translateOnProperty(mainNode), con);
    }
View Full Code Here


    protected OWLDescription translateRestriction(URI mainNode) throws OWLException {
        OWLObjectPropertyExpression prop = translateOnProperty(mainNode);
        boolean valid = false;
        OWLConstant con = getLiteralObject(mainNode, OWLRDFVocabulary.OWL_HAS_SELF.getURI(), true);
        if (con == null) {
            valid = getConsumer().isSelfRestriction(mainNode);
        } else {
            if (con.isTyped()) {
                valid = con.equals(getDataFactory().getOWLTypedConstant(true));
            } else {
                valid = con.getLiteral().equalsIgnoreCase(Boolean.TRUE.toString());
            }
        }
        if (!valid) {
            throw new MalformedDescriptionException("Object of " + OWLRDFVocabulary.OWL_HAS_SELF
                                                    + " must be \"true\"^^xsd:boolean");
View Full Code Here

        if( assertionPropertyURI == null ) {
            throw new OWLRDFXMLParserMalformedNodeException("missing owl:assertionProperty triple");
        }
        URI targetIndividualURI = getConsumer().getResourceObject(subject,
                OWLRDFVocabulary.OWL_TARGET_INDIVIDUAL.getURI(), true);
        OWLConstant targetValue = getConsumer().getLiteralObject(subject,
                OWLRDFVocabulary.OWL_TARGET_VALUE.getURI(), true);
        OWLAxiom ax;
        if( targetIndividualURI != null ) {
            if( targetValue != null ) {
                throw new OWLRDFXMLParserMalformedNodeException(
View Full Code Here

    }


    public OWLDataRangeFacetRestriction translate(URI uri) throws OWLException {
        for (OWLRestrictedDataRangeFacetVocabulary facet : OWLRestrictedDataRangeFacetVocabulary.values()) {
            OWLConstant val;
            while ((val = consumer.getLiteralObject(uri, facet.getURI(), true)) != null) {
                if (val.isTyped()) {
                    return consumer.getDataFactory().getOWLDataRangeFacetRestriction(
                           facet,
                           (OWLTypedConstant) val);
                }
                else {
                    return consumer.getDataFactory().getOWLDataRangeFacetRestriction(
                           facet,
                           consumer.getDataFactory().getOWLTypedConstant(val.getLiteral(),
                                                            OWLDataUtil.getIntDataType(consumer.getDataFactory())));
                }
            }
        }
       
View Full Code Here

        super(handler);
    }


    public void handleChild(OWLConstantElementHandler handler) throws OWLXMLParserException {
        OWLConstant con = handler.getOWLObject();
        if(con.isTyped()) {
            constant = (OWLTypedConstant) handler.getOWLObject();
        }
        else {
            throw new OWLXMLParserException(getLineNumber(), "Found untyped constant, expected typed constant");
        }
View Full Code Here

    OWLDataProperty pDouble = DataProperty( ns + "pDouble" );
    OWLDataProperty pBoolean = DataProperty( ns + "pBoolean" );

    OWLIndividual ind = Individual( ns + "ind1" );

    OWLConstant valDouble = ind.getDataPropertyValues( ont ).get(pDouble).iterator().next();
    OWLConstant valInt = ind.getDataPropertyValues( ont ).get(pInt).iterator().next();
    OWLConstant valBoolean = ind.getDataPropertyValues( ont ).get( pBoolean ).iterator().next();

    assertTrue( reasoner.isConsistent() );

    removeAxioms(ont, propertyAssertion( ind, pDouble, valDouble ) );
    reasoner.refresh();
    assertTrue( reasoner.getRelatedValues( ind, pDouble ).isEmpty() );

    removeAxioms( ont, propertyAssertion( ind, pInt, valInt ) );
    reasoner.refresh();
    assertTrue( reasoner.getRelatedValues( ind, pInt ).isEmpty() );

    removeAxioms( ont, propertyAssertion( ind, pBoolean, valBoolean ) );
    reasoner.refresh();
    assertTrue( reasoner.getRelatedValues( ind, pBoolean ).isEmpty() );

    assertTrue( reasoner.getDataPropertyRelationships( ind ).isEmpty() );

    OWLConstant newVal = constant( "0.0", XSD.DOUBLE );
    addAxioms( ont, propertyAssertion( ind, pDouble, newVal ) );
    reasoner.refresh();

    assertTrue( reasoner.isConsistent() );
  }
View Full Code Here

TOP

Related Classes of org.semanticweb.owl.model.OWLConstant

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.