Examples of Store


Examples of com.hp.hpl.jena.gvs.Store

    }
  }

  protected void performTestsWithGraphs(FCAGraph[] graphs) {
    ToyClock clock = new ToyClock();
    Store store = getStoreImpl(clock);
    Source source = new SourceImpl("http://example.org/graph-source");
    TimedGraphSequence tgs = TimedGraphSequence
        .getSequenceWithRandomDates(graphs);
    for (int i = 0; i < tgs.getSize(); i++) {
      clock.setTime(tgs.getDate(i));
      store.updateGraph(source, tgs.getGraph(i));
    }
    assertTrue(compareAllVersions(store, source, tgs));
    assertTrue(compareVersionAtRandomDate(store, source, tgs));
    // do the same again with new store instance
    try {
      store.close();
      store = new FSSToreImpl(testStoreDir);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    // assertTrue(compareAllVersions(store, source, tgs));
View Full Code Here

Examples of com.hp.hpl.jena.gvs.Store

*
*/
public class SecurityTest extends TestCase {

  public void testUnauthorizedPut() throws Exception {
    Store store = new MemoryStoreImpl();
    ServerBinding serverBinding = new ServerBinding() {

      public InetAddress getInetAddress() {
        try {
          return InetAddress.getByName("localhost");
View Full Code Here

Examples of com.hp.hpl.jena.gvs.Store

    //Policy.setPolicy(orig);
    Policy.setPolicy(null);
    Policy.setPolicy(new NoRestrictionsPolicy());

    //
    Store store = new MemoryStoreImpl();
    ServerBinding serverBinding = new ServerBinding() {

      public InetAddress getInetAddress() {
        try {
          return InetAddress.getByName("localhost");
        } catch (UnknownHostException e) {
          throw new RuntimeException(e);
        }
      }

      public int getPort() {
        return 8686;
      }

    };
    URL sourceURL = new URL("http://"
        + serverBinding.getInetAddress().getHostName() + ":"
        + serverBinding.getPort() + "/danbri");
    Source identity = new SourceImpl("http://example.org/tests/identity");
    Set<Source> trustedSources  = new HashSet<Source>();
    trustedSources.add(identity);
    NamedNode configuration = new NamedNodeImpl("http://example.org/tests/configuration#");
    Model authorizationModel = ModelFactory.createDefaultModel();
    Resource user = authorizationModel.createResource(FOAF.Agent);
    user.addProperty(ACCOUNTMANAGER.userName, "beta");
    user.addProperty(ACCOUNTMANAGER.passwordSha1, Util.sha1("tester"));
    user.addProperty(AUTHORIZATION.mayImpersonate, authorizationModel.createResource(sourceURL.toString()));
    store.assertGraph(identity, new FCAGraphImpl(authorizationModel));
    WebServer webServer = GVSServerLauncher.launchGVSServer(store, serverBinding, identity ,
        trustedSources, configuration);

    Model model = ModelFactory.createDefaultModel();
    model.read(new File("testdata/danbri-20060920123618661.rdf").toURL()
View Full Code Here

Examples of com.hp.hpl.jena.gvs.Store

    webServer.stop();

  }
 
  public void testWrongPasswordPut() throws Exception {
    Store store = new MemoryStoreImpl();
    ServerBinding serverBinding = new ServerBinding() {

      public InetAddress getInetAddress() {
        try {
          return InetAddress.getByName("localhost");
        } catch (UnknownHostException e) {
          throw new RuntimeException(e);
        }
      }

      public int getPort() {
        return 8686;
      }

    };
    URL sourceURL = new URL("http://"
        + serverBinding.getInetAddress().getHostName() + ":"
        + serverBinding.getPort() + "/danbri");
    Source identity = new SourceImpl("http://example.org/tests/identity");
    Set<Source> trustedSources  = new HashSet<Source>();
    trustedSources.add(identity);
    NamedNode configuration = new NamedNodeImpl("http://example.org/tests/configuration#");
    Model authorizationModel = ModelFactory.createDefaultModel();
    Resource user = authorizationModel.createResource(FOAF.Agent);
    user.addProperty(ACCOUNTMANAGER.userName, "beta");
    user.addProperty(ACCOUNTMANAGER.passwordSha1, Util.sha1("tester"));
    user.addProperty(AUTHORIZATION.mayImpersonate, authorizationModel.createResource(sourceURL.toString()));
    store.assertGraph(identity, new FCAGraphImpl(authorizationModel));
    WebServer webServer = GVSServerLauncher.launchGVSServer(store, serverBinding, identity ,
        trustedSources, configuration);

    Model model = ModelFactory.createDefaultModel();
    model.read(new File("testdata/danbri-20060920123618661.rdf").toURL()
View Full Code Here

Examples of com.hp.hpl.jena.gvs.Store

   */
  public boolean performTest(FCAGraph[] graphs) {
    try {
      for (int k = 0; k < 10; k++) {
        ToyClock clock = new ToyClock();
        Store store = new MemoryStoreImpl(clock);
        Source source = new SourceImpl(
            "http://example.org/graph-source");
        for (int i = 0; i < graphs.length; i++) {
          //TODO leanify on dec
          graphs[i] = new FCAGraphImpl(MoleculeBasedLeanifier
              .getLeanVersionOf(graphs[i]));
        }
        TimedGraphSequence tgs = TimedGraphSequence
            .getSequenceWithRandomDates(graphs);
        for (int i = 0; i < tgs.getSize(); i++) {
          clock.setTime(tgs.getDate(i));
          store.updateGraph(source, tgs.getGraph(i));
        }
        if (!StoreTest.compareAllVersions(store, source, tgs)) {
          return false;
        }
        // tgs.write(System.out);
View Full Code Here

Examples of com.hp.hpl.jena.gvs.Store

      public int getPort() {
        return 8686;
      }

    };
    Store store = new MemoryStoreImpl();
    File directory = new File("testdata");
    String baseURLString = "http://"
        + serverBinding.getInetAddress().getHostName() + ":"
        + serverBinding.getPort() + "/";
    CannedDataReader.readCannedData(store, directory, baseURLString);
View Full Code Here

Examples of com.hp.hpl.jena.sdb.Store

public class ExModelSDB
{
    static public void main(String...argv)
    {
        Store store = StoreFactory.create("sdb.ttl") ;
        Model model = SDBFactory.connectDefaultModel(store) ;
       
        StmtIterator sIter = model.listStatements() ;
        for ( ; sIter.hasNext() ; )
        {
            Statement stmt = sIter.nextStatement() ;
            System.out.println(stmt) ;
        }
        sIter.close() ;
        store.close() ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sdb.Store

    {
        Query query = QueryFactory.create(queryString) ;

        SDBConnection conn = new SDBConnection(jdbcConnection) ;
       
        Store store = StoreFactory.create(storeDesc, conn) ;
       
        Dataset ds = DatasetStore.create(store) ;
        QueryExecution qe = QueryExecutionFactory.create(query, ds) ;
        try {
            ResultSet rs = qe.execSelect() ;
            ResultSetFormatter.out(rs) ;
        } finally { qe.close() ; }
        // Does not close the JDBC connection.
        // Do not call : store.getConnection().close() , which does close the underlying connection.
        store.close() ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sdb.Store

        // Passing null for user and password causes them to be extracted
        // from the environment variables SDB_USER and SDB_PASSWORD
        SDBConnection conn = new SDBConnection(jdbcURL, null, null) ;

        // Make store from connection and store description.
        Store store = SDBFactory.connectStore(conn, storeDesc) ;
       
        Dataset ds = DatasetStore.create(store) ;
        QueryExecution qe = QueryExecutionFactory.create(query, ds) ;
        try {
            ResultSet rs = qe.execSelect() ;
            ResultSetFormatter.out(rs) ;
        } finally { qe.close() ; }
        store.close() ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.sdb.Store

{
    static public void main(String...argv)
    {
        String queryString = "SELECT * { ?s ?p ?o }" ;
        Query query = QueryFactory.create(queryString) ;
        Store store = SDBFactory.connectStore("sdb.ttl") ;
       
        // Must be a DatasetStore to trigger the SDB query engine.
        // Creating a graph from the Store, and adding it to a general
        // purpose dataset will not necesarily exploit full SQL generation.
        // The right answers will be obtained but slowly.
       
        Dataset ds = DatasetStore.create(store) ;
        QueryExecution qe = QueryExecutionFactory.create(query, ds) ;
        try {
            ResultSet rs = qe.execSelect() ;
            ResultSetFormatter.out(rs) ;
        } finally { qe.close() ; }
       
        // Close the SDB conenction which also closes the underlying JDBC connection.
        store.getConnection().close() ;
        store.close() ;
    }
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.