Package com.hp.hpl.jena.reasoner

Examples of com.hp.hpl.jena.reasoner.InfGraph


     *
     * @param model the Model containing both instance data and schema assertions to be inferenced over
     */
    public static InfModel createRDFSModel(Model model) {
         Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
         InfGraph graph = reasoner.bind( model.getGraph() );
         return new InfModelImpl( graph );
    }
View Full Code Here


     * @param model a Model containing instance data assertions
     * @param schema a Model containing RDFS schema data
     */
    public static InfModel createRDFSModel( Model schema, Model model ) {
         Reasoner reasoner = ReasonerRegistry.getRDFSReasoner();
         InfGraph graph  = reasoner.bindSchema(schema.getGraph()).bind(model.getGraph());
         return new InfModelImpl( graph );
    }
View Full Code Here

     * @param reasoner the reasoner to use to process the data
     * @param model the Model containing both instance data and schema assertions to be inferenced over,
     * any statements added to the InfModel will be added to this underlying data model.
     */
    public static InfModel createInfModel( Reasoner reasoner, Model model ) {
         InfGraph graph = reasoner.bind(model.getGraph());
         return new InfModelImpl(graph);
    }
View Full Code Here

     * @param schema a Model containing RDFS schema data
     * @param model a Model containing instance data assertions, any statements added to the InfModel
     * will be added to this underlying data model.
     */
    public static InfModel createInfModel(Reasoner reasoner, Model schema, Model model) {
         InfGraph graph = reasoner.bindSchema(schema.getGraph()).bind(model.getGraph());
         return new InfModelImpl( graph );
    }
View Full Code Here

    public void testIntersectionNPE() {
        Model base = ModelFactory.createDefaultModel();
        base.read("file:testing/reasoners/bugs/bad-intersection.owl");
        boolean foundBadList = false;
        try {
            InfGraph infgraph = ReasonerRegistry.getOWLReasoner().bind(base.getGraph());
            ExtendedIterator<Triple> ci = infgraph.find(null, RDF.Nodes.type, OWL.Class.asNode());
            ci.close();
        } catch (ReasonerException e) {
            foundBadList = true;
        }
        assertTrue("Correctly detected the illegal list", foundBadList);
View Full Code Here

    public Graph getGraph()
        { return getInfGraph(); }
   
    public void testInfGraph()
        {
        InfGraph ig = getInfGraph();
        assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() );
        }
View Full Code Here

        assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() );
        }
   
    public void testInfReification()
        {
        InfGraph ig = getInfGraph();
        assertInstanceOf( BasicFBReifier.class, ig.getReifier() );
        }
View Full Code Here

   
    public void testCreateInfModel()
        {
        String rule = "-> (eg:r eg:p eg:v).";
        Reasoner r = new GenericRuleReasoner( Rule.parseRules(rule) );
        InfGraph ig = r.bind( ModelFactory.createDefaultModel().getGraph() );
        InfModel im = ModelFactory.createInfModel(ig);
        assertInstanceOf( InfModel.class, im );
        assertEquals( 1, im.size() );
        }
View Full Code Here

        List<Rule> rules = Rule.parseRules(ruleSrc);
        Graph data = Factory.createGraphMem();
        for (int i = 0; i < triples.length; i++) {
            data.add(triples[i]);
        }
        InfGraph infgraph =  makeInfGraph(rules, data, tabled);
        ExtendedIterator<Triple> results = infgraph.find(query);
        assertTrue(results.hasNext());
        Triple result = results.next();
        results.close();
        Rule rule = rules.get(rulenumber);
        List<Triple> matchList = Arrays.asList(matches);
        Iterator<Derivation> derivations = infgraph.getDerivation(result);
        assertTrue(derivations.hasNext());
        RuleDerivation derivation = (RuleDerivation) derivations.next();
//        PrintWriter pw = new PrintWriter(System.out);
//        derivation.printTrace(pw, true);
//        pw.close();
View Full Code Here

        Model data = ModelFactory.createDefaultModel();
        for (int i = 0; i < testSpec.length; i++) {
            Object[] test = testSpec[i];
            Reasoner r = (Reasoner)test[0];
            Boolean safe = (Boolean)test[1];
            InfGraph ig = r.bind(data.getGraph());
            assertEquals(r.toString(), safe.booleanValue(), ig.getCapabilities().findContractSafe());
        }
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.reasoner.InfGraph

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.