Examples of Reasoner


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

        data.add(new Triple(c, q, d));
        List<Rule> rules = Rule.parseRules(
            "[r1: (c r ?x) <- (?x p f(?x b))]" +
            "[r2: (?y p f(a ?y)) <- (c q ?y)]"
                          );       
        Reasoner reasoner =  createReasoner(rules);
        InfGraph infgraph = reasoner.bind(data);
        TestUtil.assertIteratorValues(this,
              infgraph.find(c, r, null), new Object[] { } );
             
        data.add(new Triple(c, q, a));
        rules = Rule.parseRules(
        "[r1: (c r ?x) <- (?x p f(?x a))]" +
        "[r2: (?y p f(a ?y)) <- (c q ?y)]"
                          );       
        reasoner =  createReasoner(rules);
        infgraph = reasoner.bind(data);
        TestUtil.assertIteratorValues(this,
              infgraph.find(c, r, null),
              new Object[] {
                  new Triple(c, r, a)
              } );
           
        data = Factory.createGraphMem();
        data.add(new Triple(a, q, a));
        data.add(new Triple(a, q, b));
        data.add(new Triple(a, q, c));
        data.add(new Triple(b, q, d));
        data.add(new Triple(b, q, b));
        rules = Rule.parseRules(
          "[r1: (c r ?x) <- (?x p ?x)]" +
          "[r2: (?x p ?y) <- (a q ?x), (b q ?y)]"
                          );       
        reasoner =  createReasoner(rules);
        infgraph = reasoner.bind(data);
        TestUtil.assertIteratorValues(this,
              infgraph.find(c, r, null),
              new Object[] {
                  new Triple(c, r, b)
              } );
             
        rules = Rule.parseRules(
          "[r1: (c r ?x) <- (?x p ?x)]" +
          "[r2: (a p ?x) <- (a q ?x)]"
                          );       
        reasoner =  createReasoner(rules);
        infgraph = reasoner.bind(data);
        TestUtil.assertIteratorValues(this,
              infgraph.find(c, r, null),
              new Object[] {
                  new Triple(c, r, a)
              } );
View Full Code Here

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

     * additional inference work.
     *
     * @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

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

     *
     * @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

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

        schema.add(new Triple(n1, p, n3));
        Graph data = Factory.createGraphMem();
        data.add(new Triple(n1, q, n4));
        data.add(new Triple(n1, q, n3));
       
        Reasoner reasoner =  createReasoner(ruleList);
        Reasoner boundReasoner = reasoner.bindSchema(schema);
        InfGraph infgraph = boundReasoner.bind(data);

        TestUtil.assertIteratorValues(this, infgraph.find(null, null, null),
            new Triple[] {
                new Triple(n1, p, n3),
                new Triple(n2, p, n3),
View Full Code Here

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

        boolean prior = JenaParameters.enableFilteringOfHiddenInfNodes;
        try {
            JenaParameters.enableFilteringOfHiddenInfNodes = false;
            Model premisesM = FileManager.get().loadModel("file:testing/wg/equivalentClass/premises004.rdf");
            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);
            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++;
View Full Code Here

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

     * Check cost of creating an empty OWL closure.
     */
    public void temp() {
        Graph data = Factory.createGraphMem();
        Graph data2 = Factory.createGraphMem();
        Reasoner reasoner =  new OWLFBRuleReasoner(OWLFBRuleReasonerFactory.theInstance());
        FBRuleInfGraph infgraph = (FBRuleInfGraph)reasoner.bind(data);
        FBRuleInfGraph infgraph2 = (FBRuleInfGraph)reasoner.bind(data2);
        long t1 = System.currentTimeMillis();
        infgraph.prepare();
        long t2 = System.currentTimeMillis();
        System.out.println("Prepare on empty graph = " + (t2-t1) +"ms");
        t1 = System.currentTimeMillis();
View Full Code Here

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

           
            // Fetch the rule set and create the reasoner
            BuiltinRegistry.theRegistry.register(new Deduce());
            Map<String, String> prefixes = new HashMap<>();
            List<Rule> rules = loadRules(cl.getItem(0), prefixes);
            Reasoner reasoner = new GenericRuleReasoner(rules);
           
            // Process
            InfModel infModel = ModelFactory.createInfModel(reasoner, inModel);
            infModel.prepare();
            infModel.setNsPrefixes(prefixes);
View Full Code Here

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

        tBox.read(new ByteArrayInputStream(sourceT.getBytes()), "http://example.org/foo");

        Model aBox = ModelFactory.createDefaultModel();
        aBox.read(new ByteArrayInputStream(sourceA.getBytes()), "http://example.org/foo");

        Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
        reasoner = reasoner.bindSchema(tBox);

        OntModelSpec spec = new OntModelSpec(OntModelSpec.OWL_MEM_RULE_INF);
        spec.setReasoner(reasoner);

        OntModel m = ModelFactory.createOntologyModel(spec, aBox);
View Full Code Here

Examples of org.mindswap.pellet.owlapi.Reasoner

    axioms.add( classAssertion( i3, c ) );

    OWLOntology ont = getOntologyFromAxioms( axioms, ontURI );

    Reasoner reasoner = new Reasoner( OWL.manager );
    reasoner.loadOntology( ont );

    assertTrue( !reasoner.isSameAs( i1, i2 ) );
    assertTrue( !reasoner.isSameAs( i1, i3 ) );
    assertEquals( reasoner.getSameAsIndividuals( i1 ), Collections.emptySet() );

    assertTrue( !reasoner.isSameAs( i2, i1 ) );
    assertTrue( !reasoner.isSameAs( i2, i3 ) );
    assertEquals( reasoner.getSameAsIndividuals( i2 ), Collections.emptySet() );

    assertTrue( !reasoner.isSameAs( i3, i1 ) );
    assertTrue( !reasoner.isSameAs( i3, i2 ) );
    assertEquals( reasoner.getSameAsIndividuals( i2 ), Collections.emptySet() );

  }
View Full Code Here

Examples of org.semanticweb.HermiT.Reasoner

                    OWLOntologyManager ontologyManager=OWLManager.createOWLOntologyManager();
                    OWLOntology ontology=ontologyManager.loadOntology(ont);
                    long parseTime=System.currentTimeMillis()-startTime;
                    status.log(2,"Ontology parsed in "+String.valueOf(parseTime)+" msec.");
                    startTime=System.currentTimeMillis();
                    Reasoner hermit=new Reasoner(config,ontology);
                    long loadTime=System.currentTimeMillis()-startTime;
                    status.log(2,"Reasoner created in "+String.valueOf(loadTime)+" msec.");
                    if (!ignoreOntologyPrefixes)
                        prefixes.addPrefixes(hermit.getPrefixes());
                    for (Action action : actions) {
                        status.log(2,"Doing action...");
                        startTime=System.currentTimeMillis();
                        action.run(hermit,prefixes,status,output);
                        long actionTime=System.currentTimeMillis()-startTime;
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.