Package com.hp.hpl.jena.reasoner

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<String, String>();
            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


        // create a empty union graph
        MultiUnion u = new MultiUnion();
        u.addGraph( base );
        u.setBaseGraph( base );

        Reasoner r = spec.getReasoner();
        // if we have a reasoner in the spec, bind to the union graph and return
        return r == null ? (Graph) u : r.bind( u );
    }
View Full Code Here

                configuration = m.createResource();
            }
            configuration.addProperty(ReasonerVocabulary.PROPtraceOn, "true")
                         .addProperty(ReasonerVocabulary.PROPderivationLogging, "true");
        }
        Reasoner reasoner = reasonerF.create(configuration);
        long t1 = System.currentTimeMillis();
        InfGraph graph = reasoner.bind(premises.getGraph());
        Model result = ModelFactory.createModelForGraph(graph);
       
        if (stats && graph instanceof FBRuleInfGraph) {
//            ((FBRuleInfGraph)graph).resetLPProfile(true);
        }
View Full Code Here

        if (!conclusionsType.equals(FalseDocument)) {
            conclusions = loadFile(conclusionsRes.toString());
        }
       
        // Construct the inferred graph
        Reasoner reasoner = reasonerF.create(configuration);
        InfGraph graph = reasoner.bind(premises.getGraph());
        Model result = ModelFactory.createModelForGraph(graph);
       
        // Check the results against the official conclusions
        boolean correct = true;
        int goodResult = PASS;
View Full Code Here

     * @return true if the test passes
     * @throws IOException if one of the test files can't be found
     * @throws RDFException if the test can't be found or fails internally
     */
    public boolean runTest(String uri, ReasonerFactory reasonerF, TestCase testcase, Resource configuration) throws IOException {
        Reasoner reasoner = reasonerF.create(configuration);
        return runTest(uri, reasoner, testcase);
    }
View Full Code Here

  }

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

        // create a empty union graph
        MultiUnion u = new MultiUnion();
        u.addGraph( base );
        u.setBaseGraph( base );

        Reasoner r = spec.getReasoner();
        // if we have a reasoner in the spec, bind to the union graph and return
        return r == null ? (Graph) u : r.bind( u );
    }
View Full Code Here

      log.debug("@@ " +stmt);
    }
     

    String rules = SYM_RULE;
    Reasoner ruleReasoner = new GenericRuleReasoner(Rule.parseRules(rules));
    InfModel inf = ModelFactory.createInfModel(ruleReasoner, model);
    for ( Statement stmt : inf.listStatements().toList() ) {
      log.debug("^^ " +stmt);
    }
  }
View Full Code Here

    }
    log.debug("Asserted: " +noAsserted);

   
    String rules;
    Reasoner ruleReasoner;
   
    if ( useVine ) {
      rules = VINE_PREFIX_FOR_RULES
          + "\n" + VINE_UNREIFICATION_RULE
          + "\n" + SYM_RULE
View Full Code Here

        Model schemaModel = ModelFactory.createDefaultModel();
        Model configurationRuleReasoner = ModelFactory.createDefaultModel();
        com.hp.hpl.jena.rdf.model.Resource configuration = configurationRuleReasoner.createResource();
        configuration.addProperty(ReasonerVocabulary.PROPruleMode, "forward");
        configuration.addProperty(ReasonerVocabulary.PROPsetRDFSLevel, ReasonerVocabulary.RDFS_SIMPLE);
        Reasoner ruleReasoner = RDFSRuleReasonerFactory.theInstance().create(configuration);
        InfModel inf = ModelFactory.createInfModel(ruleReasoner, schemaModel, baseModel);
        inf.read(new ByteArrayInputStream(TURTLE_RDF.getBytes()), "", "TURTLE");
        return inf;
    }
View Full Code Here

TOP

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

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.