@Override public Graph createGraph(IRI name) throws UnsupportedOperationException, EntityAlreadyExistsException { initialize(); if (uriRef2GraphMap.containsKey(name)) { throw new EntityAlreadyExistsException(name); } FileGraph mGraph = new FileGraph(name, parser, serializer); uriRef2GraphMap.put(name, mGraph); writeDataFile(); return mGraph; }
targetGraph = store.createGraph(graphName); } catch (EntityAlreadyExistsException e) { if (graphName.equals(e.getEntityName())) targetGraph = store.getGraph(graphName); else targetGraph = store.createGraph(graphName);
@Override public Recipe createRecipe(IRI recipeID, String recipeDescription) throws AlreadyExistingRecipeException { Graph tripleCollection; try { // create the Graph in the TcManager tripleCollection = tcManager.createGraph(recipeID); } catch (EntityAlreadyExistsException e) { throw new AlreadyExistingRecipeException(e.getMessage()); } Triple recipeTriple = new TripleImpl(recipeID, RDF.type, Symbols.Recipe); Graph recipeIndexGraph = tcManager.getGraph(new IRI(recipeIndexLocation)); recipeIndexGraph.add(recipeTriple); if (recipeDescription != null && !recipeDescription.isEmpty()) { Triple descriptionTriple = new TripleImpl(recipeID, Symbols.description, new PlainLiteralImpl( recipeDescription)); tripleCollection.add(descriptionTriple); recipeIndexGraph.add(descriptionTriple); } // add the recpe ID to the list of known recipes recipes.add(recipeID); return new RecipeImpl(recipeID, recipeDescription, null); }
targetGraph = store.createGraph(graphName); } catch (EntityAlreadyExistsException e) { if (graphName.equals(e.getEntityName())) targetGraph = store.getGraph(graphName); else targetGraph = store.createGraph(graphName);
@Override public Recipe createRecipe(IRI recipeID, String recipeDescription) throws AlreadyExistingRecipeException { Graph tripleCollection; try { // create the Graph in the TcManager tripleCollection = tcManager.createGraph(recipeID); } catch (EntityAlreadyExistsException e) { throw new AlreadyExistingRecipeException(e.getMessage()); } Triple recipeTriple = new TripleImpl(recipeID, RDF.type, Symbols.Recipe); Graph recipeIndexGraph = tcManager.getGraph(new IRI(recipeIndexLocation)); recipeIndexGraph.add(recipeTriple); if (recipeDescription != null && !recipeDescription.isEmpty()) { Triple descriptionTriple = new TripleImpl(recipeID, Symbols.description, new PlainLiteralImpl( recipeDescription)); tripleCollection.add(descriptionTriple); recipeIndexGraph.add(descriptionTriple); } // add the recpe ID to the list of known recipes recipes.add(recipeID); return new RecipeImpl(recipeID, recipeDescription, null); }
@Override public synchronized Graph createGraph(IRI name) throws UnsupportedOperationException, EntityAlreadyExistsException { File tcDir = getGraphDir(name); if (tcDir.exists()) { throw new EntityAlreadyExistsException(name); } tcDir.mkdirs(); File otimizationIndicator = new File(tcDir, "fixed.opt"); try { otimizationIndicator.createNewFile(); } catch (IOException ex) { throw new RuntimeException(ex); } Graph result = getGraph(tcDir); dir2Lock.put(tcDir, result.getLock().writeLock()); mGraphMap.put(name, result); return result; }
graph = store.createMGraph(uriref); } catch (EntityAlreadyExistsException e) { if (uriref.equals(e.getEntityName())) graph = store.getMGraph(uriref); else graph = store.createMGraph(uriref);
@Override public Graph createGraph(IRI name) throws EntityAlreadyExistsException { if ((name == null) || (name.getUnicodeString() == null) || (name.getUnicodeString().trim().length() == 0)) { throw new IllegalArgumentException("Name must not be null"); } try { // throws NoSuchEntityException if a Graph with that name // already exists this.getGraph(name); } catch (NoSuchEntityException e) { Graph result = new SimpleGraph(); tripleMap.put(name, result); return result; } throw new EntityAlreadyExistsException(name); }
@Override public Graph createGraph(IRI name) throws UnsupportedOperationException, EntityAlreadyExistsException { if(name == null){ throw new IllegalArgumentException("The parsed MGrpah name MUST NOT be NULL!"); } datasetLock.writeLock().lock(); try { if(isExistingGraphName(name)){ throw new EntityAlreadyExistsException(name); } Graph graph = getModelGraph(name,true,true).getGraph(); addToIndex( name, Symbols.Graph); return graph; } finally { datasetLock.writeLock().unlock(); } }
@Override public Graph createGraph(IRI name) throws EntityAlreadyExistsException { if ((name == null) || (name.getUnicodeString() == null) || (name.getUnicodeString().trim().length() == 0)) { throw new IllegalArgumentException("Name must not be null"); } try { // throws NoSuchEntityException if a Graph with that name // already exists this.getGraph(name); } catch (NoSuchEntityException e) { Graph result = new SimpleGraph(); tripleMap.put(name, result); return result; } throw new EntityAlreadyExistsException(name); }
@Override public ImmutableGraph createImmutableGraph(IRI name, Graph triples) throws UnsupportedOperationException, EntityAlreadyExistsException { File tcDir = getImmutableGraphDir(name); if (tcDir.exists()) { throw new EntityAlreadyExistsException(name); } if (triples == null) { triples = new SimpleGraph(); } tcDir.mkdirs(); File otimizationIndicator = new File(tcDir, "fixed.opt"); try { otimizationIndicator.createNewFile(); } catch (IOException ex) { throw new RuntimeException(ex); } Graph mGraph = getGraph(tcDir); mGraph.addAll(triples); ImmutableGraph result = mGraph.getImmutableGraph(); TDB.sync(dir2Dataset.get(tcDir)); graphMap.put(name, result); return result; }
@Override public ImmutableGraph createImmutableGraph(IRI name, Graph triples) throws EntityAlreadyExistsException { if ((name == null) || (name.getUnicodeString() == null) || (name.getUnicodeString().trim().length() == 0)) { throw new IllegalArgumentException("Name must not be null"); } try { // throws NoSuchEntityException if a Graph with that name // already exists this.getGraph(name); } catch (NoSuchEntityException e) { ImmutableGraph result; if (triples == null) { result = new SimpleImmutableGraph(new SimpleGraph()); } else { if (ImmutableGraph.class.isAssignableFrom(triples.getClass())) { result = (ImmutableGraph) triples; } else { result = new SimpleImmutableGraph(triples); } } tripleMap.put(name, result); return result; } throw new EntityAlreadyExistsException(name); }
@Override public ImmutableGraph createImmutableGraph(IRI name, Graph triples) throws UnsupportedOperationException, EntityAlreadyExistsException { if(name == null){ throw new IllegalArgumentException("The parsed Grpah name MUST NOT be NULL!"); } ModelGraph mg; datasetLock.writeLock().lock(); try { if(isExistingGraphName(name)){ throw new EntityAlreadyExistsException(name); } mg = getModelGraph(name,false,true); addToIndex( name, Symbols.ImmutableGraph); //add the parsed data! if(triples != null) { //load the initial and final set of triples mg.getJenaAdapter().addAll(triples); mg.sync(); } } finally { datasetLock.writeLock().unlock(); } return mg.getImmutableGraph(); }
@Override public ImmutableGraph createImmutableGraph(IRI name, Graph triples) throws EntityAlreadyExistsException { if ((name == null) || (name.getUnicodeString() == null) || (name.getUnicodeString().trim().length() == 0)) { throw new IllegalArgumentException("Name must not be null"); } try { // throws NoSuchEntityException if a Graph with that name // already exists this.getGraph(name); } catch (NoSuchEntityException e) { ImmutableGraph result; if (triples == null) { result = new SimpleImmutableGraph(new SimpleGraph()); } else { if (ImmutableGraph.class.isAssignableFrom(triples.getClass())) { result = (ImmutableGraph) triples; } else { result = new SimpleImmutableGraph(triples); } } tripleMap.put(name, result); return result; } throw new EntityAlreadyExistsException(name); }
throw new EntityAlreadyExistsException(name); } else if(modelGraph == null){ String modelName = name.getUnicodeString();