Package org.apache.marmotta.kiwi.reasoner.persistence

Examples of org.apache.marmotta.kiwi.reasoner.persistence.KiWiReasoningConnection.query()


        try {

            // if there are further patterns, evaluate them; if the matched pattern was the only pattern, then
            // simply take the match as binding
            if(body.size() > 0) {
                bodyResult = connection.query(body,match,null,null,true);
            } else if(match != null) {
                bodyResult = new SingletonIteration<QueryResult, SQLException>(match);
            } else {
                bodyResult = new EmptyIteration<QueryResult, SQLException>();
            }
View Full Code Here


        Literal object = v.createLiteral(OBJECT3);

        Pattern p = new Pattern(new ResourceField(subject), new ResourceField(predicate), new LiteralField(object));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(1,results.get(0).getJustifications().size());

            KiWiTriple justification = results.get(0).getJustifications().iterator().next();
            Assert.assertEquals(subject, justification.getSubject());
View Full Code Here

        URI predicate = v.createURI(PREDICATE2);

        Pattern p = new Pattern(new VariableField("X"), new ResourceField(predicate), new VariableField("Y"));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(3, results.size());

            for(int i=0; i<3; i++) {
                Assert.assertEquals(1,results.get(i).getJustifications().size());
View Full Code Here

        Pattern p1 = new Pattern(x, new ResourceField(predicate1), y);
        Pattern p2 = new Pattern(y, new ResourceField(predicate1), z);
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(ImmutableSet.of(p1,p2), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(2, results.get(0).getJustifications().size());


            Assert.assertEquals(SUBJECT1, results.get(0).getBindings().get(x).stringValue());
View Full Code Here

        try {

            // if there are further patterns, evaluate them; if the matched pattern was the only pattern, then
            // simply take the match as binding
            if(body.size() > 0) {
                bodyResult = connection.query(body,match,null,null,true);
            } else if(match != null) {
                bodyResult = new SingletonIteration<QueryResult, SQLException>(match);
            } else {
                bodyResult = new EmptyIteration<QueryResult, SQLException>();
            }
View Full Code Here

            try {

                // if there are further patterns, evaluate them; if the matched pattern was the only pattern, then
                // simply take the match as binding
                if(body.size() > 0) {
                    bodyResult = connection.query(body,match,null,null,true);
                } else if(match != null) {
                    bodyResult = new SingletonIteration<QueryResult, SQLException>(match);
                } else {
                    bodyResult = new EmptyIteration<QueryResult, SQLException>();
                }
View Full Code Here

        Literal object = v.createLiteral(OBJECT3);

        Pattern p = new Pattern(new ResourceField(subject), new ResourceField(predicate), new LiteralField(object));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(1,results.get(0).getJustifications().size());

            KiWiTriple justification = results.get(0).getJustifications().iterator().next();
            Assert.assertEquals(subject, justification.getSubject());
View Full Code Here

        URI predicate = v.createURI(PREDICATE2);

        Pattern p = new Pattern(new VariableField("X"), new ResourceField(predicate), new VariableField("Y"));
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(Collections.singleton(p), null, null, null, true));
            Assert.assertEquals(3, results.size());

            for(int i=0; i<3; i++) {
                Assert.assertEquals(1,results.get(i).getJustifications().size());
View Full Code Here

        Pattern p1 = new Pattern(x, new ResourceField(predicate1), y);
        Pattern p2 = new Pattern(y, new ResourceField(predicate1), z);
        KiWiReasoningConnection connection = rpersistence.getConnection();
        try {
            List<QueryResult> results = asList(connection.query(ImmutableSet.of(p1,p2), null, null, null, true));
            Assert.assertEquals(1, results.size());
            Assert.assertEquals(2, results.get(0).getJustifications().size());


            Assert.assertEquals(SUBJECT1, results.get(0).getBindings().get(x).stringValue());
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.