Examples of SWRLVariable


Examples of org.semanticweb.owlapi.model.SWRLVariable

    }

    private SWRLAtom parseDataRangeAtom() {
        OWLDataRange range = parseDataRange();
        consumeToken(OPEN.keyword());
        SWRLVariable obj1 = parseDVariable();
        consumeToken(CLOSE.keyword());
        return dataFactory.getSWRLDataRangeAtom(range, obj1);
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        SWRLVariable varX = df.getSWRLVariable(IRI("urn:swrl#x"));
        SWRLVariable varY = df.getSWRLVariable(IRI("urn:swrl#y"));
        SWRLVariable varZ = df.getSWRLVariable(IRI("urn:swrl#z"));
        Set<SWRLAtom> body = new HashSet<>();
        body.add(df.getSWRLClassAtom(Class(iri("A")), varX));
        SWRLIndividualArgument indIArg = df
                .getSWRLIndividualArgument(NamedIndividual(iri("i")));
        SWRLIndividualArgument indJArg = df
                .getSWRLIndividualArgument(NamedIndividual(iri("j")));
        body.add(df.getSWRLClassAtom(Class(iri("D")), indIArg));
        body.add(df.getSWRLClassAtom(Class(iri("B")), varX));
        SWRLVariable varQ = df.getSWRLVariable(IRI("urn:swrl#q"));
        SWRLVariable varR = df.getSWRLVariable(IRI("urn:swrl#r"));
        body.add(df.getSWRLDataPropertyAtom(DataProperty(iri("d")), varX, varQ));
        OWLLiteral lit = Literal(33);
        SWRLLiteralArgument litArg = df.getSWRLLiteralArgument(lit);
        body.add(df.getSWRLDataPropertyAtom(DataProperty(iri("d")), varY,
                litArg));
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

        OWLOntologyManager m = create();
        OWLOntology o = m.createOntology(EXAMPLE_IRI);
        // Get hold of references to class A and class B.
        OWLClass clsA = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#A"));
        OWLClass clsB = df.getOWLClass(IRI.create(EXAMPLE_IRI + "#B"));
        SWRLVariable var = df.getSWRLVariable(IRI.create(EXAMPLE_IRI + "#x"));
        Set<SWRLClassAtom> body = Collections.singleton(df.getSWRLClassAtom(
                clsA, var));
        Set<SWRLClassAtom> head = Collections.singleton(df.getSWRLClassAtom(
                clsB, var));
        SWRLRule rule = df.getSWRLRule(body, head);
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

            return true;
        }
        if (!(obj instanceof SWRLVariable)) {
            return false;
        }
        SWRLVariable other = (SWRLVariable) obj;
        return other.getIRI().equals(getIRI());
    }
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

    @Nonnull
    @Override
    protected Set<? extends OWLAxiom> createAxioms() {
        Set<OWLAxiom> axioms = new HashSet<>();
        SWRLVariable varX = df.getSWRLVariable(IRI("http://www.owlapi#x"));
        SWRLVariable varY = df.getSWRLVariable(IRI("http://www.owlapi#y"));
        SWRLVariable varZ = df.getSWRLVariable(IRI("http://www.owlapi#z"));
        Set<SWRLAtom> body = new HashSet<>();
        body.add(df.getSWRLClassAtom(Class(iri("A")), varX));
        SWRLIndividualArgument indIArg = df
                .getSWRLIndividualArgument(NamedIndividual(iri("i")));
        SWRLIndividualArgument indJArg = df
                .getSWRLIndividualArgument(NamedIndividual(iri("j")));
        body.add(df.getSWRLClassAtom(Class(iri("D")), indIArg));
        body.add(df.getSWRLClassAtom(Class(iri("B")), varX));
        SWRLVariable varQ = df.getSWRLVariable(IRI("http://www.owlapi#q"));
        SWRLVariable varR = df.getSWRLVariable(IRI("http://www.owlapi#r"));
        body.add(df.getSWRLDataPropertyAtom(DataProperty(iri("d")), varX, varQ));
        OWLLiteral lit = Literal(33);
        SWRLLiteralArgument litArg = df.getSWRLLiteralArgument(lit);
        body.add(df.getSWRLDataPropertyAtom(DataProperty(iri("d")), varY,
                litArg));
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

        OWLClass clsA = Class("A", pm);
        OWLClass clsB = Class("B", pm);
        OWLClass clsC = Class("C", pm);
        OWLClass clsD = Class("D", pm);
        OWLClass clsE = Class("E", pm);
        SWRLVariable varA = dataFactory.getSWRLVariable(IRI
                .create("http://other.com/A/VarA"));
        SWRLVariable varB = dataFactory.getSWRLVariable(IRI
                .create("http://other.com/A/VarA"));
        SWRLVariable varC = dataFactory.getSWRLVariable(IRI
                .create("http://other.com/A/VarA"));
        body.add(dataFactory.getSWRLClassAtom(clsC, varA));
        body.add(dataFactory.getSWRLClassAtom(clsB, varB));
        body.add(dataFactory.getSWRLClassAtom(clsA, varC));
        head.add(dataFactory.getSWRLClassAtom(clsE, varA));
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

    }

    @Test
    public void shouldBuildSWRLVariable() {
        // given
        SWRLVariable expected = df.getSWRLVariable(iri);
        BuilderSWRLVariable builder = new BuilderSWRLVariable(expected, df);
        // when
        OWLObject built = builder.buildObject();
        // then
        assertEquals(expected, built);
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

    @Nonnull
    OWLAxiom axiom;

    @Before
    public void setUp() {
        SWRLVariable x = df.getSWRLVariable(IRI(NS + "#x"));
        SWRLAtom atom1 = df.getSWRLClassAtom(a, x);
        SWRLAtom atom2 = df.getSWRLClassAtom(b, x);
        Set<SWRLAtom> consequent = new TreeSet<>();
        consequent.add(atom1);
        OWLAnnotation annotation = df.getOWLAnnotation(RDFSComment(),
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

        // Get hold of references to class A and class B. Note that the ontology
        // does not contain class A or classB, we simply get references to
        // objects from a data factory that represent class A and class B
        OWLClass clsA = factory.getOWLClass(IRI.create(ontologyIRI + "#A"));
        OWLClass clsB = factory.getOWLClass(IRI.create(ontologyIRI + "#B"));
        SWRLVariable var = factory.getSWRLVariable(IRI.create(ontologyIRI
                + "#x"));
        SWRLRule rule = factory.getSWRLRule(
                singleton(factory.getSWRLClassAtom(clsA, var)),
                singleton(factory.getSWRLClassAtom(clsB, var)));
        manager.applyChange(new AddAxiom(ontology, rule));
View Full Code Here

Examples of org.semanticweb.owlapi.model.SWRLVariable

    @Test
    public void shouldDoCompleteRoundtrip() throws Exception {
        OWLClass a = Class(IRI(NS + "#A"));
        OWLDataProperty p = df.getOWLDataProperty(IRI(NS + "#P"));
        SWRLVariable x = df.getSWRLVariable(IRI(NS + "#X"));
        SWRLVariable y = df.getSWRLVariable(IRI(NS + "#Y"));
        OWLOntology ontology = m.createOntology(IRI(NS));
        Set<SWRLAtom> body = new TreeSet<>();
        body.add(df.getSWRLDataPropertyAtom(p, x, y));
        body.add(df.getSWRLDataRangeAtom(
                df.getOWLDatatype(XSDVocabulary.STRING.getIRI()), y));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.