congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
RecipeList
Code IndexAdd Tabnine to your IDE (free)

How to use
RecipeList
in
org.apache.stanbol.rules.base.api.util

Best Java code snippets using org.apache.stanbol.rules.base.api.util.RecipeList (Showing top 9 results out of 315)

origin: org.apache.stanbol/org.apache.stanbol.rules.manager

@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;
}
origin: apache/stanbol

public boolean retainAll(Collection<?> c) {
  Recipe[] recipesCopy = null;
  Recipe[] recipesTMP = null;
  for (Object o : c) {
    if (o instanceof Recipe) {
      if (contains(o)) {
        if (recipesCopy == null) {
          recipesCopy = new Recipe[1];
          recipesCopy[0] = (Recipe) o;
        } else {
          recipesTMP = new Recipe[recipesCopy.length + 1];
          System.arraycopy(recipesCopy, 0, recipesTMP, 0, recipesCopy.length);
          recipesTMP[recipesTMP.length - 1] = (Recipe) o;
          recipesCopy = recipesTMP;
        }
      }
    }
  }
  recipes = recipesCopy;
  return true;
}
origin: apache/stanbol

public RecipeIterator(RecipeList recipeList) {
  this.listSize = recipeList.size();
  this.recipes = new Recipe[listSize];
  this.recipes = recipeList.toArray(this.recipes);
  this.currentIndex = 0;
}
origin: stackoverflow.com

RecipeList classObject = new RecipeList();
classObject.updateList(editedRecipe);
selectedRecipe = editedRecipe;
this.loadActivity(editedRecipe);
origin: apache/stanbol

/**
 * It returns the list of recipes whose descriptions match the string passed in the description parameter.<br>
 * If some recipe matches the description passed a 200 code with the list of recipes is returned.
 * Otherwise a 404 status code is returned.
 * 
 * @param description
 *            {@link String}
 * @return <ul>
 *         <li>200: The list of recipe matching the description provided is returned</li>
 *         <li>404: No recipe matches the description provided</li>
 *         </ul>
 */
@GET
@Produces(value = {MediaType.APPLICATION_JSON, KRFormat.RDF_XML, KRFormat.TURTLE, KRFormat.OWL_XML,
          KRFormat.RDF_JSON, KRFormat.FUNCTIONAL_OWL, KRFormat.MANCHESTER_OWL,
          MediaType.TEXT_PLAIN})
@Path("/find/recipes")
public Response findRecipes(@QueryParam("description") String description) {
  log.info("Searching for recipes with description like to {}.", description);
  RecipeList recipes = ruleStore.findRecipesByDescription(description);
  log.info("The recipe list is emplty? {} ", recipes.isEmpty());
  if (recipes.isEmpty()) {
    return Response.status(Status.NOT_FOUND).build();
  }
  return Response.ok(recipes).build();
}
origin: apache/stanbol

@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;
}
origin: apache/stanbol

public boolean removeAll(Collection<?> c) {
  if (contains(c)) {
    for (Object o : c) {
      boolean removed = false;
      for (int i = 0; i < recipes.length && !removed; i++) {
        Recipe recipe = recipes[i];
        if (recipe.equals(o)) {
          Recipe[] recipesCopy = new Recipe[recipes.length - 1];
          System.arraycopy(recipes, 0, recipesCopy, 0, i);
          System.arraycopy(recipes, i + 1, recipesCopy, 0, recipesCopy.length - i);
          recipes = recipesCopy;
          removed = true;
        }
      }
    }
    return true;
  } else {
    return false;
  }
}
origin: apache/stanbol

@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;
}
origin: org.apache.stanbol/org.apache.stanbol.rules.manager

@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;
}
org.apache.stanbol.rules.base.api.utilRecipeList

Most used methods

  • <init>
  • size
  • add
  • contains
  • isEmpty
  • toArray
  • updateList

Popular in Java

  • Creating JSON documents from java classes using gson
  • runOnUiThread (Activity)
  • startActivity (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now