Package com.hp.hpl.jena.reasoner.transitiveReasoner

Examples of com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveGraphCache


    private void resetTGCCache() {
        if (schemaGraph != null) {
            transitiveEngine = new TransitiveEngine(((FBRuleInfGraph)schemaGraph).transitiveEngine);
        } else {
            transitiveEngine = new TransitiveEngine(
                new TransitiveGraphCache(ReasonerVocabulary.directSubClassOf.asNode(), RDFS.subClassOf.asNode()),
                new TransitiveGraphCache(ReasonerVocabulary.directSubPropertyOf.asNode(), RDFS.subPropertyOf.asNode()));
        }
    }
View Full Code Here


    private void resetTGCCache() {
        if (schemaGraph != null) {
            transitiveEngine = new TransitiveEngine(((FBRuleInfGraph)schemaGraph).transitiveEngine);
        } else {
            transitiveEngine = new TransitiveEngine(
                new TransitiveGraphCache(ReasonerVocabulary.directSubClassOf.asNode(), RDFS.subClassOf.asNode()),
                new TransitiveGraphCache(ReasonerVocabulary.directSubPropertyOf.asNode(), RDFS.subPropertyOf.asNode()));
        }
    }
View Full Code Here

    /**
     * Test the clone operation
     */
    public void testCloning() {
        initCache();
        TransitiveGraphCache clone = cache.deepCopy();
        // Mess with the original to check cloning
        cache.addRelation(new Triple(a, closedP, d));
        cache.addRelation(new Triple(g, closedP, a));
        doBasicTest(clone);
    }
View Full Code Here

    /**
     * Initialize the cache with some test data
     */
    private void initCache() {
        // Create a graph with reflexive references, cycles, redundant links
        cache = new TransitiveGraphCache(directP, closedP);       
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(b, closedP, e));
        cache.addRelation(new Triple(b, closedP, c));
        cache.addRelation(new Triple(e, closedP, f));
        cache.addRelation(new Triple(c, closedP, f));
View Full Code Here

    /**
     * Test a a case where an earlier version had a bug due to removing
     * a link which was required rather than redundant.
     */
    public void testBug1() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b))
        cache.addRelation(new Triple(c, closedP, a));       
        cache.addRelation(new Triple(c, closedP, b));
        cache.addRelation(new Triple(a, closedP, c));    
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, directP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b),
                new Triple(a, closedP, c),
            });
View Full Code Here

     * be incomplete. The links just
     * form a linear chain, with all closed links provided. But inserted
     * in a particular order.
     */
    public void testBug2() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(a, closedP, c));
        cache.addRelation(new Triple(b, closedP, c));       
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, directP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b)
            });
          
View Full Code Here

       
    /**
     * Test the removeRelation functionality.
     */
    public void testRemove() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(a, closedP, c));
        cache.addRelation(new Triple(b, closedP, d));
        cache.addRelation(new Triple(c, closedP, d));
        cache.addRelation(new Triple(d, closedP, e));
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, closedP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b),
                new Triple(a, closedP, b),
                new Triple(a, closedP, c),
                new Triple(a, closedP, d),
                new Triple(a, closedP, e)
            });
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(b, closedP, null)),
            new Object[] {
                new Triple(b, closedP, b),
                new Triple(b, closedP, d),
                new Triple(b, closedP, e)
            });
        cache.removeRelation(new Triple(b, closedP, d));
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, closedP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b),
                new Triple(a, closedP, b),
                new Triple(a, closedP, c),
                new Triple(a, closedP, d),
                new Triple(a, closedP, e)
            });
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(b, closedP, null)),
            new Object[] {
                new Triple(b, closedP, b),
            });
        cache.removeRelation(new Triple(a, closedP, c));
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, closedP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b)
            });
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(b, closedP, null)),
            new Object[] {
                new Triple(b, closedP, b),
            });
    }
View Full Code Here

   
    /**
     * Test direct link case with adverse ordering.
     */
    public void testDirect() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(c, closedP, d));
        cache.addRelation(new Triple(a, closedP, d));
        cache.addRelation(new Triple(b, closedP, c));
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, directP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b),
            });
    }
View Full Code Here

   
    /**
     * Test cycle detection.
     */
    public void testCycle() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(b, closedP, c));
        cache.addRelation(new Triple(a, closedP, c));
        cache.addRelation(new Triple(c, closedP, b));
        TestUtil.assertIteratorValues(this,
            cache.find(new TriplePattern(a, directP, null)),
            new Object[] {
                new Triple(a, closedP, a),
                new Triple(a, closedP, b),
                new Triple(a, closedP, c),
            });
View Full Code Here

   
    /**
     * A ring of three cycle
     */
    public void testCycle2() {
        TransitiveGraphCache cache = new TransitiveGraphCache(directP, closedP);
        cache.addRelation(new Triple(a, closedP, b));
        cache.addRelation(new Triple(a, closedP, c));
        cache.addRelation(new Triple(f, closedP, b));
        cache.addRelation(new Triple(b, closedP, g));
        cache.addRelation(new Triple(b, closedP, d));
        cache.addRelation(new Triple(d, closedP, c));
        cache.addRelation(new Triple(d, closedP, e));
        cache.addRelation(new Triple(c, closedP, e));
        cache.addRelation(new Triple(c, closedP, b));
        TestUtil.assertIteratorValues(this,
                cache.find(new TriplePattern(c, directP, null)),
                new Object[] {
                    new Triple(c, closedP, e),
                    new Triple(c, closedP, g),
                    new Triple(c, closedP, b),
                    new Triple(c, closedP, d),
                    new Triple(c, closedP, c),
                });
        TestUtil.assertIteratorValues(this,
                cache.find(new TriplePattern(null, directP, c)),
                new Object[] {
                    new Triple(a, closedP, c),
                    new Triple(b, closedP, c),
                    new Triple(d, closedP, c),
                    new Triple(f, closedP, c),
                    new Triple(c, closedP, c),
                });
        TestUtil.assertIteratorValues(this,
                cache.find(new TriplePattern(f, closedP, null)),
                new Object[] {
                    new Triple(f, closedP, f),
                    new Triple(f, closedP, b),
                    new Triple(f, closedP, c),
                    new Triple(f, closedP, d),
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.reasoner.transitiveReasoner.TransitiveGraphCache

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.