コード例 #1
0
 private Graph getOrCreatePermisionGraph() {
   try {
     return tcManager.getMGraph(permissionGraphName);
   } catch (NoSuchEntityException e) {
     return tcManager.createGraph(permissionGraphName);
   }
 }
コード例 #2
0
ファイル: Importer.java プロジェクト: eonum/eonum-server
 private LockableMGraph getDataGraph() {
   try {
     return tcm.getMGraph(DATA_GRAPH_URI);
   } catch (NoSuchEntityException e) {
     return tcm.createMGraph(DATA_GRAPH_URI);
   }
 }
コード例 #3
0
  @BeforeClass
  public static final void initYard() {
    initTestData();
    // create the graphs in Clerezza
    tcManager = TcManager.getInstance();
    MGraph graph = tcManager.createMGraph(READ_WRITEGRAPH_URI);
    // add the test data to the MGrpah
    for (TripleCollection tc : entityData.values()) {
      graph.addAll(tc);
    }
    // create the read only graph
    tcManager.createGraph(READ_ONLY_GRAPH_URI, graph);

    // init the ClerezzaYards for the created Clerezza graphs
    ClerezzaYardConfig readWriteConfig = new ClerezzaYardConfig("readWriteYardId");
    readWriteConfig.setName("Clerezza read/write Yard");
    readWriteConfig.setDescription("Tests config with pre-existing MGraph");
    readWriteConfig.setGraphUri(READ_WRITEGRAPH_URI);
    readwriteYard = new ClerezzaYard(readWriteConfig);

    ClerezzaYardConfig readOnlyYardConfig = new ClerezzaYardConfig("readOnlyYardId");
    readOnlyYardConfig.setName("Clerezza read-only Yard");
    readOnlyYardConfig.setDescription("Tests config with pre-existing Graph");
    readOnlyYardConfig.setGraphUri(READ_ONLY_GRAPH_URI);
    readonlyYard = new ClerezzaYard(readOnlyYardConfig);
  }
コード例 #4
0
 private static MGraph createClerezzaModel() {
   TcManager manager = TcManager.getInstance();
   UriRef graphUri = new UriRef(HTTP_EXAMPLE_COM);
   if (manager.listMGraphs().contains(graphUri)) {
     manager.deleteTripleCollection(graphUri);
   }
   return manager.createMGraph(graphUri);
 }
コード例 #5
0
 private Collection<String> getRequiredPermissionStrings(final IRI GraphUri, IRI property) {
   try {
     final Graph permissionMGraph = tcManager.getMGraph(permissionGraphName);
     Lock l = permissionMGraph.getLock().readLock();
     l.lock();
     try {
       Triple t = permissionMGraph.filter(GraphUri, property, null).next();
       BlankNodeOrIRI list = (BlankNodeOrIRI) t.getObject();
       LinkedList<String> result = new LinkedList<String>();
       readList(list, permissionMGraph, result);
       return result;
     } catch (NoSuchElementException e) {
       return new ArrayList<String>(0);
     } finally {
       l.unlock();
     }
   } catch (NoSuchEntityException e) {
     return new ArrayList<String>(0);
   }
 }
コード例 #6
0
 @AfterClass
 public static void cleanup() {
   tcManager.deleteTripleCollection(READ_ONLY_GRAPH_URI);
   tcManager.deleteTripleCollection(READ_WRITEGRAPH_URI);
 }