Examples of InfModel


Examples of com.hp.hpl.jena.rdf.model.InfModel

  private void checkConsistency(OntModel ont, File rdf) {
    try {
      Model m = ModelFactory.createDefaultModel();
      m.add(ont);
      m.read(new FileInputStream(rdf),currentBase);
      InfModel inf = ModelFactory.createInfModel(reasoner,m);
      assertTrue(inf.validate().isValid());
    }
    catch (Exception e) {
      fail(e.getMessage());     
    }
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

      return null;
    }
    log.info("Creating InfModel with rules:\n\t" +rulesSrc.replaceAll("\n", "\n\t"));
    List<Rule> rules = Rule.parseRules(rulesSrc);
    Reasoner reasoner = new GenericRuleReasoner(rules);
    InfModel im = ModelFactory.createInfModel(reasoner, _model);
    return im;
  }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

  /**
   * Gets the model in place for updates. If this object has been initialized with
   * inference and infer is true, then the corresponding InfModel is returned; otherwise the raw model.
   */
  private Model _getEffectiveModel(boolean infer)  {
    InfModel infModel = _getInfModel();
    if (infModel == null || !infer) {
      return _getModel();
    }
    else {
      return infModel;
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

       
        // create an empty model
        Model emptyModel = ModelFactory.createDefaultModel( );
       
        // create an inferencing model using Pellet reasoner
        InfModel model = ModelFactory.createInfModel( reasoner, emptyModel );
           
        // read the file
        model.read( ont );
       
        // print validation report
        ValidityReport report = model.validate();
        printIterator( report.getReports(), "Validation Results" );
       
        // print superclasses
        Resource c = model.getResource( ns + "MaleStudentWith3Daughters" );        
        printIterator(model.listObjectsOfProperty(c, RDFS.subClassOf), "All super classes of " + c.getLocalName());
       
        System.out.println();
    }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

       
        // create an empty model
        Model emptyModel = ModelFactory.createDefaultModel( );
       
        // create an inferencing model using Pellet reasoner
        InfModel model = ModelFactory.createInfModel( reasoner, emptyModel );
           
        // read the file
        model.read( ont );
       
        // print validation report
        ValidityReport report = model.validate();
        printIterator( report.getReports(), "Validation Results" );
       
        // print superclasses
        Resource c = model.getResource( ns + "MaleStudentWith3Daughters" );        
        printIterator(model.listObjectsOfProperty(c, RDFS.subClassOf), "All super classes of " + c.getLocalName());
       
        System.out.println();
    }
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

    // create the reasoner factory and the reasoner
    Resource conf = model.createResource();
    //conf.addProperty( ReasonerVocabulary.PROPtraceOn, "true" );
    RDFSRuleReasoner reasoner = (RDFSRuleReasoner) RDFSRuleReasonerFactory.theInstance().create(conf);
    // Create inference model
    InfModel infModel = ModelFactory.createInfModel(reasoner, model);
   
    model = infModel;
   
   
    propertyAccountName.add(ResourceFactory.createProperty(
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

    // create the reasoner factory and the reasoner
    Resource conf = model.createResource();
    //conf.addProperty( ReasonerVocabulary.PROPtraceOn, "true" );
    RDFSRuleReasoner reasoner = (RDFSRuleReasoner) RDFSRuleReasonerFactory.theInstance().create(conf);
    // Create inference model
    InfModel infModel = ModelFactory.createInfModel(reasoner, model);
   
    //model = infModel;
   
   
    propertyAccountName.add(ResourceFactory.createProperty(foafNamespace, "accountName"));
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

        // create the reasoner factory and the reasoner
    Resource conf = model.createResource();
    //conf.addProperty( ReasonerVocabulary.PROPtraceOn, "true" );
    RDFSRuleReasoner reasoner = (RDFSRuleReasoner) RDFSRuleReasonerFactory.theInstance().create(conf);
    // Create inference model
    InfModel infModel = ModelFactory.createInfModel(reasoner, model);
   
    model = infModel;
       
        System.out.println("Base Namespace:"+model.getNsPrefixURI(""));
       
View Full Code Here

Examples of com.hp.hpl.jena.rdf.model.InfModel

  {
    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

Examples of com.hp.hpl.jena.rdf.model.InfModel

    }
     

    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
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.