@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 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); }