@Override public RecipeList listRecipes() throws NoSuchRecipeException, RecipeConstructionException { RecipeList recipeList = new RecipeList(); for (IRI recipeID : recipes) { Recipe recipe; try { recipe = getRecipe(recipeID); } catch (NoSuchRecipeException e) { throw e; } catch (RecipeConstructionException e) { throw e; } recipeList.add(recipe); } log.info("The Clerezza rule store contains {} recipes", recipeList.size()); return recipeList; }
@Override public RecipeList listRecipes() throws NoSuchRecipeException, RecipeConstructionException { RecipeList recipeList = new RecipeList(); for (IRI recipeID : recipes) { Recipe recipe; try { recipe = getRecipe(recipeID); } catch (NoSuchRecipeException e) { throw e; } catch (RecipeConstructionException e) { throw e; } recipeList.add(recipe); } log.info("The Clerezza rule store contains {} recipes", recipeList.size()); return recipeList; }
RecipeList classObject = new RecipeList(); classObject.updateList(editedRecipe); selectedRecipe = editedRecipe;
@Override public RecipeList findRecipesByDescription(String term) { String sparql = "SELECT ?recipe " + "WHERE { ?recipe a " + Symbols.Recipe.toString() + " . " + "?recipe " + Symbols.description + " ?description . " + "FILTER (regex(?description, \"" + term + "\", \"i\"))" + "}"; Graph tripleCollection = tcManager.getGraph(new IRI(recipeIndexLocation)); RecipeList matchingRecipes = new RecipeList(); try { SelectQuery query = (SelectQuery) QueryParser.getInstance().parse(sparql); ResultSet resultSet = tcManager.executeSparqlQuery(query, tripleCollection); while (resultSet.hasNext()) { SolutionMapping solutionMapping = resultSet.next(); IRI recipeID = (IRI) solutionMapping.get("recipe"); try { Recipe recipe = getRecipe(recipeID); log.info("Found recipe {}.", recipeID.toString()); matchingRecipes.add(recipe); log.info("Found {} matching recipes.", matchingRecipes.size()); } catch (NoSuchRecipeException e) { // in this case go on in the iteration by fetching other matching recipes } catch (RecipeConstructionException e) { // in this case go on in the iteration by fetching other matching recipes } } } catch (ParseException e) { log.error("The sparql query contains errors: ", e); } return matchingRecipes; }
@Override public RecipeList findRecipesByDescription(String term) { String sparql = "SELECT ?recipe " + "WHERE { ?recipe a " + Symbols.Recipe.toString() + " . " + "?recipe " + Symbols.description + " ?description . " + "FILTER (regex(?description, \"" + term + "\", \"i\"))" + "}"; Graph tripleCollection = tcManager.getGraph(new IRI(recipeIndexLocation)); RecipeList matchingRecipes = new RecipeList(); try { SelectQuery query = (SelectQuery) QueryParser.getInstance().parse(sparql); ResultSet resultSet = tcManager.executeSparqlQuery(query, tripleCollection); while (resultSet.hasNext()) { SolutionMapping solutionMapping = resultSet.next(); IRI recipeID = (IRI) solutionMapping.get("recipe"); try { Recipe recipe = getRecipe(recipeID); log.info("Found recipe {}.", recipeID.toString()); matchingRecipes.add(recipe); log.info("Found {} matching recipes.", matchingRecipes.size()); } catch (NoSuchRecipeException e) { // in this case go on in the iteration by fetching other matching recipes } catch (RecipeConstructionException e) { // in this case go on in the iteration by fetching other matching recipes } } } catch (ParseException e) { log.error("The sparql query contains errors: ", e); } return matchingRecipes; }