Package de.fuberlin.wiwiss.d2rq.jena

Examples of de.fuberlin.wiwiss.d2rq.jena.GraphD2RQ


    reload();
  }
 
  private void reload() {
    loader.getMapping().connect();
    GraphD2RQ graph = loader.getGraphD2RQ();
   
    datasetGraph = DatasetGraphFactory.createOneGraph(graph);
    defaultModel = ModelFactory.createModelForGraph(datasetGraph.getDefaultGraph());   

    hasTruncatedResults = false;
View Full Code Here


    assertEquals(1, mapping.classMapResources().size());
  }
 
  public void testDefaultMappingWithHelloWorld() {
    db.executeSQL("INSERT INTO TEST VALUES (1, 'Hello World!')");
    GraphD2RQ g = generateDefaultGraphD2RQ();
    assertTrue(g.contains(Node.ANY, Node.ANY, Node.createLiteral("Hello World!")));
  }
View Full Code Here

  }
 
  public void testGenerateEmptyGraphFromSimpleD2RQMapping() {
    Mapping m = MappingHelper.readFromTestFile("helpers/simple.ttl");
    m.configuration().setServeVocabulary(false);
    GraphD2RQ g = new GraphD2RQ(m);
    assertTrue(g.isEmpty());
  }
View Full Code Here

 
  public void testGenerateTripleFromSimpleD2RQMapping() {
    Mapping m = MappingHelper.readFromTestFile("helpers/simple.ttl");
    m.configuration().setServeVocabulary(false);
    db.executeSQL("INSERT INTO TEST VALUES (1, 'Hello World!')");
    GraphD2RQ g = new GraphD2RQ(m);
    assertTrue(g.contains(
        Node.createURI(EX + "test/1"), RDF.Nodes.type, Node.createURI(EX + "Test")));
    assertEquals(1, g.size());
  }
View Full Code Here

  private Mapping generateDefaultMapping() {
    return new MapParser(generateDefaultMappingModel(), EX).parse();
  }
 
  private GraphD2RQ generateDefaultGraphD2RQ() {
    return new GraphD2RQ(generateDefaultMapping());
  }
View Full Code Here

      db.close();
    }
  }
 
  private GraphD2RQ getGraph(Mapping mapping) {
    return new GraphD2RQ(mapping);
  }
View Full Code Here

    ModelD2RQ m = new ModelD2RQ(D2RQTestSuite.DIRECTORY_URL + "prefixes.ttl");
    assertEquals("http://example.org/", m.getNsPrefixURI("ex"));
  }
 
  public void testCopyPrefixesFromMapModelToD2RQGraph() {
    GraphD2RQ g = new ModelD2RQ(
        FileManager.get().loadModel(D2RQTestSuite.DIRECTORY_URL + "prefixes.ttl"), null).getGraph();
    assertEquals("http://example.org/", g.getPrefixMapping().getNsPrefixURI("ex"));
  }
View Full Code Here

    // Parse mapping file
    MapParser parser = new MapParser(mapModel, "http://localhost:2020/");
    Mapping mapping = parser.parse();
   
    // Set up the GraphD2RQ
    GraphD2RQ g = new GraphD2RQ(mapping);

    // Create a find(spo) pattern
    Node subject = Node.ANY;
    Node predicate = DC.date.asNode();
    Node object = Node.createLiteral("2003", null, XSDDatatype.XSDgYear);
    Triple pattern = new Triple(subject, predicate, object);

    // Query the graph
    Iterator<Triple> it = g.find(pattern);
   
    // Output query results
    while (it.hasNext()) {
      Triple t = it.next();
        System.out.println("Published in 2003: " + t.getSubject());
    }
    g.close();
  }
View Full Code Here

TOP

Related Classes of de.fuberlin.wiwiss.d2rq.jena.GraphD2RQ

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.