use of org.apache.clerezza.commons.rdf.IRI in project stanbol by apache.
the class RuleStoreTest method removeRuleInRecipeTest.
private void removeRuleInRecipeTest() throws Exception {
Recipe recipe = store.getRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"));
String tmp = recipe.toString();
Rule rule = recipe.getRule(recipe.listRuleNames().get(0));
store.removeRule(recipe, rule);
Recipe recipe2 = store.getRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"));
String tmp2 = recipe2.toString();
Assert.assertNotSame(tmp, tmp2);
}
use of org.apache.clerezza.commons.rdf.IRI in project stanbol by apache.
the class RuleStoreTest method createRecipeTest.
private void createRecipeTest() throws Exception {
Recipe recipe = store.createRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"), "The text recipe named A.");
if (recipe == null) {
Assert.fail();
}
log.debug("Created recipe with ID " + recipe.getRecipeID().toString());
}
use of org.apache.clerezza.commons.rdf.IRI in project stanbol by apache.
the class RuleStoreTest method addRuleToRecipeTest.
private void addRuleToRecipeTest() throws Exception {
Recipe recipe = store.getRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"));
String separator = System.getProperty("line.separator");
String rule = "rule1[" + separator + " is(<http://dbpedia.org/ontology/Person>, ?x) . " + separator + " has(<http://dbpedia.org/ontology/playsInTeam>, ?x, ?y) . " + separator + " is (<http://dbpedia.org/ontology/FootballTeam>, ?y) " + separator + " -> " + separator + " is(<http://dbpedia.org/ontology/FootballPlayer>, ?x)" + separator + "] . " + "rule2[" + separator + " is(<http://dbpedia.org/ontology/Organisation>, ?x) . " + separator + " has(<http://dbpedia.org/ontology/hasProduct>, ?x, ?y)" + separator + " -> " + separator + " is(<http://dbpedia.org/ontology/Company>, ?x)" + separator + "]";
store.addRulesToRecipe(recipe, rule, "This is a test rule.");
if (recipe == null) {
Assert.fail();
}
log.debug("Got recipe with ID " + recipe.getRecipeID().toString());
}
use of org.apache.clerezza.commons.rdf.IRI in project stanbol by apache.
the class RuleStoreTest method getNotExistingRuleByNameInRecipeTest.
private void getNotExistingRuleByNameInRecipeTest() throws Exception {
Recipe recipe = store.getRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"));
try {
recipe.getRule("ruleX");
Assert.fail();
} catch (NoSuchRuleInRecipeException e) {
Assert.assertTrue(true);
}
}
use of org.apache.clerezza.commons.rdf.IRI in project stanbol by apache.
the class RuleStoreTest method getRecipeTest.
private void getRecipeTest() throws Exception {
Recipe recipe = store.getRecipe(new IRI("http://incubator.apache.com/stanbol/rules/test/recipeA"));
if (recipe == null) {
Assert.fail();
} else {
System.out.println("Recipe: " + recipe.toString());
}
log.debug("Got recipe with ID " + recipe.getRecipeID().toString());
}
Aggregations