Package org.apache.stanbol.rules.base.api

Examples of org.apache.stanbol.rules.base.api.Recipe


    @Override
    public RecipeList listRecipes() throws NoSuchRecipeException, RecipeConstructionException {
        RecipeList recipeList = new RecipeList();

        for (UriRef recipeID : recipes) {
            Recipe recipe;
            try {
                recipe = getRecipe(recipeID);
            } catch (NoSuchRecipeException e) {
                throw e;
            } catch (RecipeConstructionException e) {
View Full Code Here


            while (resultSet.hasNext()) {
                SolutionMapping solutionMapping = resultSet.next();
                UriRef recipeID = (UriRef) 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) {
View Full Code Here

                UriRef recipeID = (UriRef) solutionMapping.get("recipe");
                UriRef ruleID = (UriRef) solutionMapping.get("rule");
                Literal description = (Literal) solutionMapping.get("description");

                try {
                    Recipe recipe = getRecipe(recipeID);
                    Rule rule = new RecipeRule(recipe, getRule(recipe, ruleID));
                    if (description != null) {
                        rule.setDescription(description.getLexicalForm());
                    }
View Full Code Here

                UriRef recipeID = (UriRef) solutionMapping.get("recipe");
                UriRef ruleID = (UriRef) solutionMapping.get("rule");
                Literal description = (Literal) solutionMapping.get("description");

                try {
                    Recipe recipe = getRecipe(recipeID);
                    Rule rule = new RecipeRule(recipe, getRule(recipe, ruleID));
                    if (description != null) {
                        rule.setDescription(description.getLexicalForm());
                    }
View Full Code Here

    public static void main(String[] args){
        RuleAdapter ruleAdapter = new JenaAdapter();
        try {
            KB kb = RuleParserImpl.parse("http://sssw.org/2012/rules/", new FileInputStream("/Users/mac/Documents/CNR/SSSW2012/rules/exercise1"));
            System.out.println("Rules: " + kb.getRuleList().size());
            Recipe recipe = new RecipeImpl(new UriRef("http://sssw.org/2012/rules/"), "Recipe", kb.getRuleList());
           
            List<com.hp.hpl.jena.reasoner.rulesys.Rule> jenaRules = (List<com.hp.hpl.jena.reasoner.rulesys.Rule>) ruleAdapter.adaptTo(recipe, com.hp.hpl.jena.reasoner.rulesys.Rule.class);
           
            String rules = "[ Exercise1: (http://dbpedia.org/resource/Madrid http://dbpedia.org/ontology/locationOf ?location) (?location rdf:type http://dbpedia.org/ontology/Museum) (?location http://dbpedia.org/ontology/numberOfVisitors ?visitors) greaterThan(?visitors '2000000'^^http://www.w3.org/2001/XMLSchema#integer) -> (?location rdf:type http://www.mytravels.com/Itinerary/MadridItinerary) ]";
           
View Full Code Here

        MGraph mGraph = tcm.createMGraph(new UriRef(
                "http://incubator.apache.com/stanbol/rules/refactor/test/graph"));
        mGraph.addAll(tripleCollection);

        Recipe recipe;
        try {
            recipe = store.createRecipe(new UriRef(
                    "http://incubator.apache.com/stanbol/rules/refactor/test/recipeA"),
                "Recipe for testing the Refactor.");
            recipe = store.addRulesToRecipe(recipe, rule, "Test");
View Full Code Here

    }

    @Test
    public void refactoringTest() throws Exception {

        Recipe recipe = store.getRecipe(new UriRef(
                "http://incubator.apache.com/stanbol/rules/refactor/test/recipeA"));

        TripleCollection tc = refactorer.graphRefactoring(new UriRef(
                "http://incubator.apache.com/stanbol/rules/refactor/test/graph"), recipe.getRecipeID());

        Assert.assertNotNull(tc);

    }
View Full Code Here

    }

    @Test
    public void easyRefactoringTest() throws Exception {

        Recipe recipe = store.getRecipe(new UriRef(
                "http://incubator.apache.com/stanbol/rules/refactor/test/recipeA"));
        try {

            TripleCollection tc = refactorer.graphRefactoring(tripleCollection, recipe);
View Full Code Here

    public static void main(String[] args){
        RuleAdapter ruleAdapter = new ClerezzaAdapter();
        try {
            KB kb = RuleParserImpl.parse("http://sssw.org/2012/rules/", new FileInputStream("/Users/mac/Documents/CNR/SSSW2012/construct/exercise3"));
            System.out.println("Rules: " + kb.getRuleList().size());
            Recipe recipe = new RecipeImpl(new UriRef("http://sssw.org/2012/rules/"), "Recipe", kb.getRuleList());
           
            //List<ConstructQuery> jenaRules = (List<ConstructQuery>) ruleAdapter.adaptTo(recipe, ConstructQuery.class);
           
            String rules = "[ Exercise1: (http://dbpedia.org/resource/Madrid http://dbpedia.org/ontology/locationOf ?location) (?location rdf:type http://dbpedia.org/ontology/Museum) (?location http://dbpedia.org/ontology/numberOfVisitors ?visitors) greaterThan(?visitors '2000000'^^http://www.w3.org/2001/XMLSchema#integer) -> (?location rdf:type http://www.mytravels.com/Itinerary/MadridItinerary) ]";
           
View Full Code Here

        String rule = "kres = <http://kres.iks-project.eu/ontology.owl#> . " + separator
                      + "foaf = <http://xmlns.com/foaf/0.1/> . " + separator
                      + "rule2[ is(kres:Person, ?x) . same(localname(?y), \"text\") -> is(foaf:Person, ?x) ]";

        try {
            Recipe recipe = store.getRecipe(new UriRef(
                    "http://incubator.apache.com/stanbol/rules/refactor/test/recipeA"));

            recipe = store.addRulesToRecipe(recipe, rule, "Test");

            refactorer.graphRefactoring(new UriRef(
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.Recipe

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.