Package com.hp.hpl.jena.rdf.model

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


        Statement asserted = base.createStatement(r, p, l);
        r.addProperty(p, l);
       
        List<Rule> rules = Rule.parseRules("(?r eg:p ?v) -> (?v eg:q ?r).");
        GenericRuleReasoner reasoner = new GenericRuleReasoner(rules);
        InfModel inf = ModelFactory.createInfModel(reasoner, base);
        TestUtil.assertIteratorValues(this, inf.listStatements(), new Statement[]{asserted});
       
        Model deductions = inf.getDeductionsModel();
        TestUtil.assertIteratorValues(this, deductions.listStatements(), new Statement[]{});
       
        Graph safeGraph = deductions.getGraph();
        assertTrue(safeGraph instanceof SafeGraph);
       
View Full Code Here


            // properties out of rdfs:domain and rdfs:range properties
            // A simple rdfs reasoner is enough for this task.
            Model schema = ModelFactory.createDefaultModel();
            schema.read(schemaURL);
            Reasoner reasoner = ReasonerRegistry.getRDFSSimpleReasoner().bindSchema(schema);
            InfModel inf = ModelFactory.createInfModel(reasoner, config);

            // If we do inferencing, we can easily check for consistency.
            ValidityReport reports = inf.validate();
            if (!reports.isValid())
            {
                StringBuilder sb = new StringBuilder();
                sb.append("The configuration of the MetadataConverterPlugin is ");
                sb.append("not valid regarding the schema (");
View Full Code Here

    try {
      String aOnt = "file:" + PelletTestSuite.base + "misc/ticket-247-test-case.rdf";
 
      PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();
 
      InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );
 
      aModel.read( aOnt );
 
      String aQuery = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
              "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n" +
              "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
              "SELECT ?x WHERE { ?y rdfs:comment ?x . }";
View Full Code Here

    // Test case for the bug reproted in #277
    String aOnt = "file:" + PelletTestSuite.base + "misc/ticket-277-test-case.rdf";

    PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();

    InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

    aModel.read( aOnt );

    String aQuery = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
            "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n" +
            "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
            "SELECT ?y ?foo WHERE { ?y rdf:type ?x . }";
View Full Code Here

      String aOnt = "file:" + PelletTestSuite.base + "misc/ticket-276-test-case.rdf";

      // Test case for #276
      PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();

      InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

      aModel.read( aOnt );

      String aQuery = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n" +
              "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n" +
              "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
              "SELECT ?x WHERE { ?y rdf:type owl:Thing . ?y rdfs:comment ?x . }";
View Full Code Here

    // Test case for #248
    String aOnt = "file:" + PelletTestSuite.base + "misc/pizza.owl";

    PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();

    InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

    aModel.read( aOnt );

    String aQuery = "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\n" +
            "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
            "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n" +
            "PREFIX owl:<http://www.w3.org/2002/07/owl#>\n" +
View Full Code Here

    // Test case for #196
    String aOnt = "file:" + PelletTestSuite.base + "misc/pizza.owl";

    PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();

    InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

    aModel.read( aOnt );

    String aQuery = "PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>\n" +
            "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n" +
            "PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>\n" +
            "PREFIX owl:<http://www.w3.org/2002/07/owl#>\n" +
View Full Code Here

  @Test
  public void test306() {
    String aOnt = "file:" + PelletTestSuite.base + "misc/longitude.ttl";
   
    PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();
    InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

    aModel.read( aOnt, "N3" );
    String aQuery = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
        + "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
        + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
        + "PREFIX mon: <http://www.semwebtech.org/mondial/10/meta#>\n"
        + "PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>\n"
        + "PREFIX : <foo://bla/>\n"
        + "SELECT ?v0 WHERE\n" + "{ ?v0 rdf:type :EasternHemispherePlace. }\n";
   
    QueryExecution qe = SparqlDLExecutionFactory.create( QueryFactory.create(aQuery), aModel );

    Resource berlin = aModel.getResource( "foo://bla/Berlin" );
    ResultSet results = qe.execSelect();
    assertTrue( results.hasNext() );
    assertTrue( berlin.equals( results.next().getResource("v0") ) );
    assertFalse( results.hasNext() );
  }
View Full Code Here

  @Test
  public void test253() {
    String aOnt = "file:" + PelletTestSuite.base + "misc/longitude2.ttl";
   
    PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();
    InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );

    aModel.read( aOnt, "N3" );
    String aQuery = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
        + "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"
        + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
        + "PREFIX mon: <http://www.semwebtech.org/mondial/10/meta#>\n"
        + "PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>\n"
        + "PREFIX : <foo://bla/>\n"
        + "SELECT ?v0 WHERE\n" + "{ ?v0 rdf:type :EasternHemispherePlace. }\n";
   
    QueryExecution qe = SparqlDLExecutionFactory.create( QueryFactory.create(aQuery), aModel );

    Resource berlin = aModel.getResource( "foo://bla/Berlin" );
    ResultSet results = qe.execSelect();
    assertTrue( results.hasNext() );
    assertTrue( berlin.equals( results.next().getResource("v0") ) );
    assertFalse( results.hasNext() );
  }
View Full Code Here

      ARQ.getContext().set(ARQ.optFilterPlacement, false);
     
      String aOnt = "file:" + PelletTestSuite.base + "misc/ticket-210-test-case.owl";
     
      PelletReasoner aReasoner = (PelletReasoner) PelletReasonerFactory.theInstance().create();
      InfModel aModel = ModelFactory.createInfModel( aReasoner, ModelFactory.createDefaultModel() );
 
      aModel.read(aOnt);
      String aQuery = "PREFIX : <http://www.semanticweb.org/ontologies/2010/5/ticket-210-test-case.owl#>\n"   
        + "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>\n"
        + "PREFIX owl: <http://www.w3.org/2002/07/owl#>\n"
        + "SELECT ?x\n"
        + "WHERE {\n"
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.InfModel

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.