Package com.hp.hpl.jena.reasoner

Examples of com.hp.hpl.jena.reasoner.InfGraph.find()


        TestUtil.assertIteratorValues(this, infgraph.find(n2, s, null),
            new Triple[] {
                new Triple(n2, s, NodeFactory.createLiteral("notLiteral", "", null)),
                new Triple(n2, s, NodeFactory.createLiteral("notBNode", "", null)),
            });
        TestUtil.assertIteratorValues(this, infgraph.find(n3, s, null),
            new Triple[] {
                new Triple(n3, s, NodeFactory.createLiteral("notLiteral", "", null)),
                new Triple(n3, s, NodeFactory.createLiteral("bNode", "", null)),
            });
        
View Full Code Here


        data.add(new Triple(n3, p, NodeFactory.createLiteral("foo", "", XSDDatatype.XSDstring)) );
        data.add(new Triple(n4, p, n4));
        data.add(new Triple(n5, p, NodeFactory.createLiteral("-1", "", XSDDatatype.XSDnonNegativeInteger)) );
        infgraph = createInfGraph(rules, data);
       
        TestUtil.assertIteratorValues(this, infgraph.find(null, s, null),
            new Triple[] {
                new Triple(n1, s, NodeFactory.createLiteral("isLiteral", "", null)),
                new Triple(n1, s, NodeFactory.createLiteral("isXSDInt", "", null)),
                new Triple(n1, s, NodeFactory.createLiteral("notXSDString", "", null)),
View Full Code Here

        data.add(new Triple(n1, p, Util.makeIntNode(2)) );
        data.add(new Triple(n1, p, Util.makeIntNode(2)) );
        data.add(new Triple(n1, p, Util.makeIntNode(3)) );
        data.add(new Triple(n1, p, n2) );
        infgraph = createInfGraph(rules, data);
        TestUtil.assertIteratorValues(this, infgraph.find(n1, s, null),
            new Triple[] {
                new Triple(n1, s, Util.makeIntNode(2)),
            });
       
        // Map list operation
View Full Code Here

        rules = "[r1: (n1 p ?l) -> listMapAsSubject(?l, q, C1)]" +
                "[r2: (n1 p ?l) -> listMapAsObject ( a, q, ?l)]";
        data = Factory.createGraphMem();
        data.add(new Triple(n1, p, Util.makeList(new Node[]{b, c, d}, data) ));
        infgraph = createInfGraph(rules, data);
        TestUtil.assertIteratorValues(this, infgraph.find(null, q, null),
            new Triple[] {
                new Triple(b, q, C1),
                new Triple(c, q, C1),
                new Triple(d, q, C1),
                new Triple(a, q, b),
View Full Code Here

            "[r2: (?x p ?y) uriConcat('http://jena.hpl.hp.com/test#', ?y, ?z) -> (?x q ?z) ]";
        Graph data = Factory.createGraphMem();
        data.add(new Triple(n1, p, NodeFactory.createLiteral("test")) );
        InfGraph infgraph = createInfGraph(rules, data);
       
        TestUtil.assertIteratorValues(this, infgraph.find(null, q, null),
            new Triple[] {
            new Triple(n1, q, NodeFactory.createLiteral("testhttp://www.w3.org/1999/02/22-rdf-syntax-ns#typefoo")),
            new Triple(n1, q, NodeFactory.createLiteral("")),
            new Triple(n1, q, NodeFactory.createURI("http://jena.hpl.hp.com/test#test")),
            });
View Full Code Here

            "";
        data = Factory.createGraphMem();
        data.add(new Triple(n1, p, NodeFactory.createLiteral("foo bar foo")) );
        data.add(new Triple(n2, p, NodeFactory.createLiteral("foo bar baz")) );
        infgraph = createInfGraph(rules, data);
        TestUtil.assertIteratorValues(this, infgraph.find(null, q, null),
                new Triple[] {
                new Triple(n1, q, NodeFactory.createLiteral("ok")),
                });
        TestUtil.assertIteratorValues(this, infgraph.find(null, r, null),
                new Triple[] {
View Full Code Here

        infgraph = createInfGraph(rules, data);
        TestUtil.assertIteratorValues(this, infgraph.find(null, q, null),
                new Triple[] {
                new Triple(n1, q, NodeFactory.createLiteral("ok")),
                });
        TestUtil.assertIteratorValues(this, infgraph.find(null, r, null),
                new Triple[] {
                new Triple(n1, r, NodeFactory.createLiteral("bar")),
                });
    }
   
View Full Code Here

            Graph data = premisesM.getGraph();
            Reasoner reasoner =  new OWLFBRuleReasoner(OWLFBRuleReasonerFactory.theInstance());
            InfGraph infgraph = reasoner.bind(data);
            Node rbPrototypeProp = NodeFactory.createURI(ReasonerVocabulary.RBNamespace+"prototype");
            int count = 0;
            for (Iterator<Triple> i = infgraph.find(null, rbPrototypeProp, null); i.hasNext(); ) {
                Object t = i.next();
//                System.out.println(" - " + PrintUtil.print(t));
                count++;
            }
//            listFBGraph("direct databind case", (FBRuleInfGraph)infgraph);
View Full Code Here

//            listFBGraph("direct databind case", (FBRuleInfGraph)infgraph);
            assertEquals(5, count);
           
            infgraph = reasoner.bindSchema(data).bind(Factory.createGraphMem());
            count = 0;
            for (Iterator<Triple> i = infgraph.find(null, rbPrototypeProp, null); i.hasNext(); ) {
                Triple t = i.next();
//                System.out.println(" - " + PrintUtil.print(t));
                count++;
            }
//            listFBGraph("bindSchema case", (FBRuleInfGraph)infgraph);
View Full Code Here

        String rules =  "[r1: (?n p ?x) (?n q ?y) makeSkolem(?s ?x ?y) -> (?n s ?s)]";
        Graph data = Factory.createGraphMem();
        data.add(new Triple(n1, p, x));
        data.add(new Triple(n1, q, y));
        InfGraph infgraph = createInfGraph(rules, data);
        return infgraph.find(n1, s, Node.ANY).next().getObject();
    }
   
    private Node getSkolem(Node x) {
        String rules =  "[r1: (?n p ?x)  makeSkolem(?s ?x) -> (?n s ?s)]";
        Graph data = Factory.createGraphMem();
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.