Examples of KiWiTriple


Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

            // 1) the expected inferred triple exists
            // 2) the inferred triple is properly justified (based on rule2 and on the triple contained in the transaction data)
            List<Statement> inferred = Iterations.asList(con.getStatements(object,property,subject, true));
            Assert.assertEquals("number of inferred triples differs from expected result",1,inferred.size());

            KiWiTriple triple = (KiWiTriple)inferred.get(0);
            List<Justification> justifications = Iterations.asList(rcon.listJustificationsForTriple(triple));
            Assert.assertEquals("number of justifications for triple differs from expected result",1,justifications.size());

            Justification j = justifications.get(0);
            Assert.assertEquals("number of supporting triples differs from expected result",1,j.getSupportingTriples().size());
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

            // 1) the expected inferred triple exists (must be (ex:a ex:transitive ex:c) )
            // 2) the inferred triple is properly justified (based on rule2 and on the triple contained in the transaction data)
            List<Statement> inferred = Iterations.asList(con.getStatements(a,property,c, true));
            Assert.assertEquals("number of inferred triples differs from expected result",1,inferred.size());

            KiWiTriple triple = (KiWiTriple)inferred.get(0);
            List<Justification> justifications = Iterations.asList(rcon.listJustificationsForTriple(triple));
            Assert.assertEquals("number of justifications for triple differs from expected result",1,justifications.size());

            Justification j = justifications.get(0);
            Assert.assertEquals("number of supporting triples differs from expected result",2,j.getSupportingTriples().size());
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

            connection.storeNode(pred_2);
            connection.storeNode(object_1);
            connection.storeNode(object_2);
            connection.storeNode(context);

            KiWiTriple triple1 = new KiWiTriple(subject1,pred_1,object_1,context);
            KiWiTriple triple2 = new KiWiTriple(subject2,pred_2,object_2,context);

            connection.storeTriple(triple1);
            connection.storeTriple(triple2);
            connection.commit();
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

            connection.storeNode(pred_2);
            connection.storeNode(object_1);
            connection.storeNode(object_2);
            connection.storeNode(context);

            KiWiTriple triple1 = new KiWiTriple(subject,pred_1,object_1,context);
            KiWiTriple triple2 = new KiWiTriple(subject,pred_2,object_2,context);

            connection.storeTriple(triple1);
            connection.storeTriple(triple2);
            connection.commit();
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

    private void executeReasoner(TransactionData data) {
        updateTaskStatus("fetching worklist");
        Set<KiWiTriple> newTriples = new HashSet<KiWiTriple>();
        for(Statement stmt : data.getAddedTriples()) {
            KiWiTriple t = (KiWiTriple)stmt;
            if(t.isMarkedForReasoning()) {
                newTriples.add(t);
                t.setMarkedForReasoning(false);
            }
        }

        //taskManagerService.setTaskSteps(newTriples.size() + data.getRemovedTriples().size());
        // evaluate the rules for all added triples
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

     * @param removedTriples
     */
    private void cleanupJustifications(KiWiReasoningConnection connection, TripleTable<Statement> removedTriples) throws SQLException {
        updateTaskStatus("cleaning up justifications for " + removedTriples.size() + " removed triples");
        for(Statement stmt : removedTriples) {
            KiWiTriple t = (KiWiTriple)stmt;
            connection.deleteJustifications(t);
        }
    }
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

                        object = ((LiteralField)rule.getHead().getObject()).getLiteral();
                    } else
                        throw new IllegalArgumentException("Object of rule head may only be a variable, a literal, or a resource; rule: "+rule);


                    KiWiTriple triple = isail.addInferredStatement(subject, property, object);

                    Justification justification = new Justification();
                    justification.setTriple(triple);
                    justification.getSupportingRules().add(rule);
                    justification.getSupportingTriples().addAll(row.getJustifications());
View Full Code Here

Examples of org.apache.marmotta.kiwi.model.rdf.KiWiTriple

    private Set<Justification> getBaseJustifications(KiWiReasoningConnection connection, Set<Justification> justifications) throws SQLException {
        Set<Justification> baseJustifications = new HashSet<Justification>();
        Map<KiWiTriple,Collection<Justification>> justificationCache = new HashMap<KiWiTriple, Collection<Justification>>();

        for(Justification justification : justifications) {
            KiWiTriple triple = justification.getTriple();

            Justification newJustification = new Justification();
            newJustification.setSupportingRules(justification.getSupportingRules());
            newJustification.setTriple(triple);
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.