Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLDataFactory


        String number = tmp.getNumber();

        SWRLDArgument swrldArgument = null;

        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        if (number.startsWith(Symbols.variablesPrefix)) {

            swrldArgument = factory.getSWRLVariable(IRI.create(number));

        } else {

            Number n = null;
            if (number.contains("\\.")) {
View Full Code Here


        SWRLAtom predicateAtom = (SWRLAtom) adapter.adaptTo(objectProperty, SWRLRule.class);
        SWRLAtom subjectAtom = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
        SWRLAtom objectAtom = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);

        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        OWLObjectProperty owlObjectProperty;
        SWRLIArgument swrliArgument1;
        SWRLIArgument swrliArgument2;

        if (predicateAtom instanceof ArgumentSWRLAtom) {
            owlObjectProperty = factory.getOWLObjectProperty(IRI.create(((ArgumentSWRLAtom) predicateAtom)
                    .getId()));
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        if (subjectAtom instanceof ArgumentSWRLAtom) {
            swrliArgument1 = (SWRLIArgument) ((ArgumentSWRLAtom) subjectAtom).getSwrlArgument();
        } else {
            throw new RuleAtomCallExeption(getClass());
        }
        if (objectAtom instanceof ArgumentSWRLAtom) {
            swrliArgument2 = (SWRLIArgument) ((ArgumentSWRLAtom) objectAtom).getSwrlArgument();
        } else {
            throw new RuleAtomCallExeption(getClass());
        }

        return (T) factory.getSWRLObjectPropertyAtom(owlObjectProperty, swrliArgument1, swrliArgument2);

    }
View Full Code Here

        dropSrc = getLocalSource("/ontologies/droppedcharacters.owl");
        nonexSrc = getLocalSource("/ontologies/nonexistentcharacters.owl");
        inMemorySrc = new ParentPathInputSource(new File(TestClerezzaSpaces.class.getResource(
            "/ontologies/maincharacters.owl").toURI()));

        OWLDataFactory df = OWLManager.getOWLDataFactory();
        OWLClass cHuman = df.getOWLClass(IRI.create(baseIri + "/" + Constants.humanBeing));
        OWLIndividual iLinus = df.getOWLNamedIndividual(IRI.create(baseIri + "/" + Constants.linus));
        linusIsHuman = df.getOWLClassAssertionAxiom(cHuman, iLinus);

        factory = new ClerezzaCollectorFactory(new ClerezzaOntologyProvider(tcManager, offline, parser),
                new Hashtable<String,Object>());
        factory.setDefaultNamespace(IRI.create("http://stanbol.apache.org/ontology/"));
    }
View Full Code Here

        return argument1.prettyPrint() + ">" + argument2.prettyPrint();
    }

    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;
    }
View Full Code Here

        return "leq(" + argument1.toString() + ", " + argument2.toString() + ")";
    }

    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;
    }
View Full Code Here

        return "geq(" + argument1.toString() + ", " + argument2.toString() + ")";
    }

    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;
    }
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.UpperCaseAtom tmp = (org.apache.stanbol.rules.manager.atoms.UpperCaseAtom) ruleAtom;

        StringFunctionAtom stringFunction = tmp.getStringFunctionAtom();

        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        SWRLAtom stringFunctionAtom = (SWRLAtom) adapter.adaptTo(stringFunction, SWRLRule.class);

        SWRLDArgument retArgument = factory.getSWRLVariable(IRI.create(Symbols.variablesPrefix
                                                                       + lowercase_result));
        ;
        SWRLDArgument stringArgument;

        List<SWRLAtom> listOfArguments = new ArrayList<SWRLAtom>();

        if (stringFunctionAtom instanceof HigherOrderSWRLAtom) {
            stringArgument = ((HigherOrderSWRLAtom) stringFunctionAtom).getBindableArgument();

            listOfArguments.addAll(((HigherOrderSWRLAtom) stringFunctionAtom).getAtoms());
        } else if (stringFunctionAtom instanceof ArgumentSWRLAtom) {
            SWRLArgument swrlArgument = ((ArgumentSWRLAtom) stringFunctionAtom).getSwrlArgument();
            stringArgument = (SWRLDArgument) swrlArgument;
        } else {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        List<SWRLDArgument> swrldArguments = new ArrayList<SWRLDArgument>();
        swrldArguments.add(retArgument);
        swrldArguments.add(stringArgument);

        return (T) factory.getSWRLBuiltInAtom(SWRLBuiltInsVocabulary.LOWER_CASE.getIRI(), swrldArguments);

    }
View Full Code Here

        return "different(" + stringFunctionAtom1.toString() + ", " + stringFunctionAtom2.toString() + ")";
    }

    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;
    }
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.GreaterThanAtom tmp = (org.apache.stanbol.rules.manager.atoms.GreaterThanAtom) ruleAtom;

        ExpressionAtom argument1 = tmp.getArgument1();
        ExpressionAtom argument2 = tmp.getArgument2();

        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        SWRLAtom swrlAtom1 = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
        SWRLAtom swrlAtom2 = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);

        SWRLDArgument swrldArgument1;
        SWRLDArgument swrldArgument2;

        List<SWRLAtom> listOfArguments = new ArrayList<SWRLAtom>();

        if (swrlAtom1 instanceof HigherOrderSWRLAtom) {
            swrldArgument1 = ((HigherOrderSWRLAtom) swrlAtom1).getBindableArgument();

            listOfArguments.addAll(((HigherOrderSWRLAtom) swrlAtom1).getAtoms());
        } else if (swrlAtom1 instanceof ArgumentSWRLAtom) {
            SWRLArgument swrlArgument = ((ArgumentSWRLAtom) swrlAtom1).getSwrlArgument();
            swrldArgument1 = (SWRLDArgument) swrlArgument;
        } else {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        if (swrlAtom2 instanceof HigherOrderSWRLAtom) {
            swrldArgument2 = ((HigherOrderSWRLAtom) swrlAtom2).getBindableArgument();

            listOfArguments.addAll(((HigherOrderSWRLAtom) swrlAtom2).getAtoms());
        } else if (swrlAtom2 instanceof ArgumentSWRLAtom) {
            SWRLArgument swrlArgument = ((ArgumentSWRLAtom) swrlAtom2).getSwrlArgument();
            swrldArgument2 = (SWRLDArgument) swrlArgument;
        } else {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        List<SWRLDArgument> swrldArguments = new ArrayList<SWRLDArgument>();
        swrldArguments.add(swrldArgument1);
        swrldArguments.add(swrldArgument2);

        SWRLBuiltInAtom swrlBuiltInAtom = factory.getSWRLBuiltInAtom(
            SWRLBuiltInsVocabulary.GREATER_THAN.getIRI(), swrldArguments);
        return (T) swrlBuiltInAtom;

    }
View Full Code Here

        org.apache.stanbol.rules.manager.atoms.LessEqualThanAtom tmp = (org.apache.stanbol.rules.manager.atoms.LessEqualThanAtom) ruleAtom;

        ExpressionAtom argument1 = tmp.getArgument1();
        ExpressionAtom argument2 = tmp.getArgument2();

        OWLDataFactory factory = OWLManager.getOWLDataFactory();

        SWRLAtom swrlAtom1 = (SWRLAtom) adapter.adaptTo(argument1, SWRLRule.class);
        SWRLAtom swrlAtom2 = (SWRLAtom) adapter.adaptTo(argument2, SWRLRule.class);

        SWRLDArgument swrldArgument1;
        SWRLDArgument swrldArgument2;

        List<SWRLAtom> listOfArguments = new ArrayList<SWRLAtom>();

        if (swrlAtom1 instanceof HigherOrderSWRLAtom) {
            swrldArgument1 = ((HigherOrderSWRLAtom) swrlAtom1).getBindableArgument();

            listOfArguments.addAll(((HigherOrderSWRLAtom) swrlAtom1).getAtoms());
        } else if (swrlAtom1 instanceof ArgumentSWRLAtom) {
            SWRLArgument swrlArgument = ((ArgumentSWRLAtom) swrlAtom1).getSwrlArgument();
            swrldArgument1 = (SWRLDArgument) swrlArgument;
        } else {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        if (swrlAtom2 instanceof HigherOrderSWRLAtom) {
            swrldArgument2 = ((HigherOrderSWRLAtom) swrlAtom2).getBindableArgument();

            listOfArguments.addAll(((HigherOrderSWRLAtom) swrlAtom2).getAtoms());
        } else if (swrlAtom2 instanceof ArgumentSWRLAtom) {
            SWRLArgument swrlArgument = ((ArgumentSWRLAtom) swrlAtom2).getSwrlArgument();
            swrldArgument2 = (SWRLDArgument) swrlArgument;
        } else {
            throw new org.apache.stanbol.rules.base.api.RuleAtomCallExeption(getClass());
        }

        List<SWRLDArgument> swrldArguments = new ArrayList<SWRLDArgument>();
        swrldArguments.add(swrldArgument1);
        swrldArguments.add(swrldArgument2);

        SWRLBuiltInAtom swrlBuiltInAtom = factory.getSWRLBuiltInAtom(
            SWRLBuiltInsVocabulary.LESS_THAN_OR_EQUAL.getIRI(), swrldArguments);
        return (T) swrlBuiltInAtom;

    }
View Full Code Here

TOP

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

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.