Search in sources :

Example 86 with IRI

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);
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) Recipe(org.apache.stanbol.rules.base.api.Recipe) Rule(org.apache.stanbol.rules.base.api.Rule)

Example 87 with IRI

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());
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) Recipe(org.apache.stanbol.rules.base.api.Recipe)

Example 88 with IRI

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());
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) Recipe(org.apache.stanbol.rules.base.api.Recipe)

Example 89 with IRI

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);
    }
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) NoSuchRuleInRecipeException(org.apache.stanbol.rules.base.api.NoSuchRuleInRecipeException) Recipe(org.apache.stanbol.rules.base.api.Recipe)

Example 90 with IRI

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());
}
Also used : IRI(org.apache.clerezza.commons.rdf.IRI) Recipe(org.apache.stanbol.rules.base.api.Recipe)

Aggregations

IRI (org.apache.clerezza.commons.rdf.IRI)346 BlankNodeOrIRI (org.apache.clerezza.commons.rdf.BlankNodeOrIRI)113 Graph (org.apache.clerezza.commons.rdf.Graph)109 TripleImpl (org.apache.clerezza.commons.rdf.impl.utils.TripleImpl)104 Triple (org.apache.clerezza.commons.rdf.Triple)88 RDFTerm (org.apache.clerezza.commons.rdf.RDFTerm)84 Test (org.junit.Test)78 PlainLiteralImpl (org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl)58 HashSet (java.util.HashSet)50 ContentItem (org.apache.stanbol.enhancer.servicesapi.ContentItem)46 EngineException (org.apache.stanbol.enhancer.servicesapi.EngineException)39 HashMap (java.util.HashMap)38 IOException (java.io.IOException)37 ArrayList (java.util.ArrayList)37 Blob (org.apache.stanbol.enhancer.servicesapi.Blob)36 Literal (org.apache.clerezza.commons.rdf.Literal)35 SimpleGraph (org.apache.clerezza.commons.rdf.impl.utils.simple.SimpleGraph)31 IndexedGraph (org.apache.stanbol.commons.indexedgraph.IndexedGraph)29 Recipe (org.apache.stanbol.rules.base.api.Recipe)29 Language (org.apache.clerezza.commons.rdf.Language)24