Search in sources :

Example 11 with OWLLiteral

use of org.semanticweb.owlapi.model.OWLLiteral in project stanbol by apache.

the class GreaterEqualThanAtom method getOWLTypedLiteral.

private OWLLiteral getOWLTypedLiteral(Object argument) {
    OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
    OWLLiteral owlLiteral;
    if (argument instanceof String) {
        owlLiteral = factory.getOWLTypedLiteral((String) argument);
    } else if (argument instanceof Integer) {
        owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
    } else if (argument instanceof Double) {
        owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
    } else if (argument instanceof Float) {
        owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
    } else if (argument instanceof Boolean) {
        owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
    } else {
        owlLiteral = factory.getOWLStringLiteral(argument.toString());
    }
    return owlLiteral;
}
Also used : OWLLiteral(org.semanticweb.owlapi.model.OWLLiteral) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory)

Example 12 with OWLLiteral

use of org.semanticweb.owlapi.model.OWLLiteral in project stanbol by apache.

the class GreaterThanAtom method getOWLTypedLiteral.

private OWLLiteral getOWLTypedLiteral(Object argument) {
    OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
    OWLLiteral owlLiteral;
    if (argument instanceof String) {
        owlLiteral = factory.getOWLTypedLiteral((String) argument);
    } else if (argument instanceof Integer) {
        owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
    } else if (argument instanceof Double) {
        owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
    } else if (argument instanceof Float) {
        owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
    } else if (argument instanceof Boolean) {
        owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
    } else {
        owlLiteral = factory.getOWLStringLiteral(argument.toString());
    }
    return owlLiteral;
}
Also used : OWLLiteral(org.semanticweb.owlapi.model.OWLLiteral) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory)

Example 13 with OWLLiteral

use of org.semanticweb.owlapi.model.OWLLiteral in project stanbol by apache.

the class LessEqualThanAtom method getOWLTypedLiteral.

private OWLLiteral getOWLTypedLiteral(Object argument) {
    OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
    OWLLiteral owlLiteral;
    if (argument instanceof String) {
        owlLiteral = factory.getOWLTypedLiteral((String) argument);
    } else if (argument instanceof Integer) {
        owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
    } else if (argument instanceof Double) {
        owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
    } else if (argument instanceof Float) {
        owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
    } else if (argument instanceof Boolean) {
        owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
    } else {
        owlLiteral = factory.getOWLStringLiteral(argument.toString());
    }
    return owlLiteral;
}
Also used : OWLLiteral(org.semanticweb.owlapi.model.OWLLiteral) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory)

Example 14 with OWLLiteral

use of org.semanticweb.owlapi.model.OWLLiteral in project stanbol by apache.

the class LessThanAtom method getOWLTypedLiteral.

private OWLLiteral getOWLTypedLiteral(Object argument) {
    OWLDataFactory factory = OWLManager.createOWLOntologyManager().getOWLDataFactory();
    OWLLiteral owlLiteral;
    if (argument instanceof String) {
        owlLiteral = factory.getOWLTypedLiteral((String) argument);
    } else if (argument instanceof Integer) {
        owlLiteral = factory.getOWLTypedLiteral(((Integer) argument).intValue());
    } else if (argument instanceof Double) {
        owlLiteral = factory.getOWLTypedLiteral(((Double) argument).doubleValue());
    } else if (argument instanceof Float) {
        owlLiteral = factory.getOWLTypedLiteral(((Float) argument).floatValue());
    } else if (argument instanceof Boolean) {
        owlLiteral = factory.getOWLTypedLiteral(((Boolean) argument).booleanValue());
    } else {
        owlLiteral = factory.getOWLStringLiteral(argument.toString());
    }
    return owlLiteral;
}
Also used : OWLLiteral(org.semanticweb.owlapi.model.OWLLiteral) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory)

Example 15 with OWLLiteral

use of org.semanticweb.owlapi.model.OWLLiteral in project stanbol by apache.

the class SWRLLiteralBuilder method getSWRLLiteral.

public static SWRLLiteralArgument getSWRLLiteral(Object argument) {
    OWLDataFactory factory = OWLManager.getOWLDataFactory();
    OWLLiteral owlLiteral;
    if (argument instanceof TypedLiteralAtom) {
        TypedLiteralAtom typedLiteralAtom = (TypedLiteralAtom) argument;
        URIResource xsdType = typedLiteralAtom.getXsdType();
        if (xsdType.getURI().equals(XSD.xboolean)) {
            owlLiteral = factory.getOWLLiteral(Boolean.valueOf(argument.toString()).booleanValue());
        } else if (xsdType.getURI().equals(XSD.xdouble)) {
            owlLiteral = factory.getOWLLiteral(Double.valueOf(argument.toString()).doubleValue());
        } else if (xsdType.getURI().equals(XSD.xfloat)) {
            owlLiteral = factory.getOWLLiteral(Float.valueOf(argument.toString()).floatValue());
        } else if (xsdType.getURI().equals(XSD.xint)) {
            owlLiteral = factory.getOWLLiteral(Integer.valueOf(argument.toString()).intValue());
        } else {
            owlLiteral = factory.getOWLLiteral(argument.toString());
        }
    } else if (argument instanceof String) {
        owlLiteral = factory.getOWLLiteral((String) argument);
    } else if (argument instanceof Integer) {
        owlLiteral = factory.getOWLLiteral(((Integer) argument).intValue());
    } else if (argument instanceof Double) {
        owlLiteral = factory.getOWLLiteral(((Double) argument).doubleValue());
    } else if (argument instanceof Float) {
        owlLiteral = factory.getOWLLiteral(((Float) argument).floatValue());
    } else if (argument instanceof Boolean) {
        owlLiteral = factory.getOWLLiteral(((Boolean) argument).booleanValue());
    } else {
        owlLiteral = factory.getOWLLiteral(argument.toString());
    }
    return factory.getSWRLLiteralArgument(owlLiteral);
}
Also used : URIResource(org.apache.stanbol.rules.base.api.URIResource) OWLLiteral(org.semanticweb.owlapi.model.OWLLiteral) OWLDataFactory(org.semanticweb.owlapi.model.OWLDataFactory) TypedLiteralAtom(org.apache.stanbol.rules.manager.atoms.TypedLiteralAtom)

Aggregations

OWLLiteral (org.semanticweb.owlapi.model.OWLLiteral)16 OWLDataFactory (org.semanticweb.owlapi.model.OWLDataFactory)12 OWLAnnotationProperty (org.semanticweb.owlapi.model.OWLAnnotationProperty)7 OWLClass (org.semanticweb.owlapi.model.OWLClass)6 OWLObjectProperty (org.semanticweb.owlapi.model.OWLObjectProperty)6 OWLAnnotationAssertionAxiom (org.semanticweb.owlapi.model.OWLAnnotationAssertionAxiom)5 OWLClassAssertionAxiom (org.semanticweb.owlapi.model.OWLClassAssertionAxiom)5 OWLDataProperty (org.semanticweb.owlapi.model.OWLDataProperty)5 OWLDataPropertyAssertionAxiom (org.semanticweb.owlapi.model.OWLDataPropertyAssertionAxiom)5 OWLNamedIndividual (org.semanticweb.owlapi.model.OWLNamedIndividual)5 OWLObjectPropertyAssertionAxiom (org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom)5 IRI (org.semanticweb.owlapi.model.IRI)4 OWLAnnotation (org.semanticweb.owlapi.model.OWLAnnotation)4 AddAxiom (org.semanticweb.owlapi.model.AddAxiom)3 OWLOntology (org.semanticweb.owlapi.model.OWLOntology)3 OWLOntologyCreationException (org.semanticweb.owlapi.model.OWLOntologyCreationException)3 OWLOntologyManager (org.semanticweb.owlapi.model.OWLOntologyManager)3 Statement (com.hp.hpl.jena.rdf.model.Statement)2 StmtIterator (com.hp.hpl.jena.rdf.model.StmtIterator)2 OWLDatatype (org.semanticweb.owlapi.model.OWLDatatype)2