Package org.openrdf.sail.memory

Examples of org.openrdf.sail.memory.MemoryStore


  return sesameRepository;
    }

    void initRepository(){
  try {
      sesameRepository = new SailRepository(new MemoryStore());
      sesameRepository.initialize();
      connection = sesameRepository.getConnection();
  }
  catch (RepositoryException ex){
      System.err.println("Error while initializing Sesame repository:");
View Full Code Here


    /** add the classes and properties of an ontology into the store
     *@param docURI the ontology's URI
     *@param locationPath an alternative local path where the ontology can be found (null if none); cam be given as a relative path
     */
    public void addOntology(String docURI, String locationPath){
  Repository r = new SailRepository(new MemoryStore());
  try {
      r.initialize();
      RepositoryConnection c = r.getConnection();
      if (DEBUG){
    System.out.println("Retrieving ontology "+docURI);
View Full Code Here

  }

  public void testWrite()
    throws RepositoryException, RDFParseException, IOException, RDFHandlerException
  {
    Repository rep1 = new SailRepository(new MemoryStore());
    rep1.initialize();

    RepositoryConnection con1 = rep1.getConnection();

    URL ciaScheme = this.getClass().getResource("/cia-factbook/CIA-onto-enhanced.rdf");
    URL ciaFacts = this.getClass().getResource("/cia-factbook/CIA-facts-enhanced.rdf");

    con1.add(ciaScheme, ciaScheme.toExternalForm(), RDFFormat.forFileName(ciaScheme.toExternalForm()));
    con1.add(ciaFacts, ciaFacts.toExternalForm(), RDFFormat.forFileName(ciaFacts.toExternalForm()));

    StringWriter writer = new StringWriter();
    RDFWriter rdfWriter = rdfWriterFactory.getWriter(writer);
    con1.export(rdfWriter);

    con1.close();

    Repository rep2 = new SailRepository(new MemoryStore());
    rep2.initialize();

    RepositoryConnection con2 = rep2.getConnection();

    con2.add(new StringReader(writer.toString()), "foo:bar", RDFFormat.RDFXML);
View Full Code Here

    String outputURL = inputURL;
    String baseURL = NTRIPLES_TEST_URL;
    suite.addTest(new PositiveParserTest(testName, inputURL, outputURL, baseURL));

    // Add the manifest for positive test cases to a repository and query it
    Repository repository = new SailRepository(new MemoryStore());
    repository.initialize();
    RepositoryConnection con = repository.getConnection();

    url = TurtleParserTest.class.getResource(MANIFEST_GOOD_URL);
    con.add(url, url.toExternalForm(), RDFFormat.TURTLE);
View Full Code Here

    throws Exception
  {
    TestSuite suite = new TestSuite();

    // Read manifest and create declared test cases
    Repository manifestRep = new SailRepository(new MemoryStore());
    manifestRep.initialize();

    RepositoryConnection con = manifestRep.getConnection();

    logger.debug("Loading manifest data");
View Full Code Here

    assertTrue("Repository should contain newly added statement", testCon.hasStatement(statement, false));
    assertTrue("Repository should contain newly added statement", testCon.hasStatement(alice, name,
        nameAlice, false));

    Repository tempRep = new SailRepository(new MemoryStore());
    tempRep.initialize();
    RepositoryConnection con = tempRep.getConnection();

    con.add(testCon.getStatements(null, null, null, false));
View Full Code Here

  }

  protected Repository createRepository()
    throws RepositoryException
  {
    Repository dataRep = new DatasetRepository(new SailRepository(new MemoryStore()));
    dataRep.initialize();
    return dataRep;
  }
View Full Code Here

    logger.info("Building test suite for {}", manifestFileURL);

    TestSuite suite = new TestSuite();

    // Read manifest and create declared test cases
    Repository manifestRep = new SailRepository(new MemoryStore());
    manifestRep.initialize();
    RepositoryConnection con = manifestRep.getConnection();

    con.add(new URL(manifestFileURL), manifestFileURL, RDFFormat.TURTLE);
View Full Code Here

  {
    String query = readQuery();

    // Create a repository with the query data

    Sail sail = new MemoryStore();

    if ("RDF".equals(entailment)) {
      // do not add inferencers
    }
    else if ("RDFS".equals(entailment)) {
      sail = new ForwardChainingRDFSInferencer(sail);
    }
    else if ("RDFS-VP".equals(entailment)) {
      sail = new ForwardChainingRDFSInferencer(sail);
      sail = new DirectTypeHierarchyInferencer(sail);
    }
    else {
      sail.shutDown();
      fail("Invalid value for entailment level:" + entailment);
    }

    Repository dataRep = new SailRepository(sail);
    dataRep.initialize();

    RepositoryConnection dataCon = dataRep.getConnection();

    // Add unnamed gaph
    dataCon.add(new URL(dataFile), null, RDFFormat.forFileName(dataFile));

    // add named graphs
    for (String graphName : graphNames) {
      dataCon.add(new URL(graphName), null, RDFFormat.forFileName(graphName), new URIImpl(graphName));
    }

    // Evaluate the query on the query data
    GraphQueryResult result = dataCon.prepareGraphQuery(QueryLanguage.SERQL, query).evaluate();
    Collection<Statement> actualStatements = Iterations.addAll(result, new ArrayList<Statement>(1));
    result.close();

    dataCon.close();
    dataRep.shutDown();

    // Create a repository with the expected result data
    Repository expectedResultRep = new SailRepository(new MemoryStore());
    expectedResultRep.initialize();

    RepositoryConnection erCon = expectedResultRep.getConnection();

    erCon.add(new URL(resultFile), null, RDFFormat.forFileName(resultFile));
View Full Code Here

    throws Exception
  {
    TestSuite suite = new TestSuite();

    // Read manifest and create declared test cases
    Repository manifestRep = new SailRepository(new MemoryStore());
    manifestRep.initialize();

    RepositoryConnection con = manifestRep.getConnection();

    URL manifestURL = SeRQLQueryTest.class.getResource(MANIFEST_FILE);
View Full Code Here

TOP

Related Classes of org.openrdf.sail.memory.MemoryStore

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.