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

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


    @SuppressWarnings("unchecked")
    @Override
    public void graphRefactoring(UriRef refactoredOntologyID, UriRef datasetID, UriRef recipeID) throws RefactoringException,
                                                                                                NoSuchRecipeException {

        Recipe recipe;
        try {
            try {
                recipe = ruleStore.getRecipe(recipeID);

                RuleAdapter ruleAdapter = ruleAdapterManager.getAdapter(recipe, ConstructQuery.class);
View Full Code Here


        // JenaToOwlConvert jenaToOwlConvert = new JenaToOwlConvert();

        // OntModel ontModel =
        // jenaToOwlConvert.ModelOwlToJenaConvert(inputOntology, "RDF/XML");

        Recipe recipe;
        try {
            recipe = ruleStore.getRecipe(recipeID);

            RuleAdapter ruleAdapter = ruleAdapterManager.getAdapter(recipe, ConstructQuery.class);
View Full Code Here

            return false;
        }
    }

    public Recipe next() {
        Recipe recipe = recipes[currentIndex];
        currentIndex++;
        return recipe;
    }
View Full Code Here

    }

    public boolean remove(Object o) {
        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;
View Full Code Here

    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;
View Full Code Here

    }

    @Override
    public boolean equals(Object obj) {
        if (obj instanceof Recipe) {
            Recipe recipe = (Recipe) obj;

            if (recipe.getRecipeID().toString().equals(this.getRecipeID().toString())) {
                if (recipe.getRecipeDescription().equals(this.getRecipeDescription())) {
                    if (recipe.toString().equals(this.toString())) {
                        return true;
                    } else {
                        return false;
                    }
                } else {
View Full Code Here

        removeRuleInRecipeTest();
        removeRecipeTest();
    }
   
    private void createRecipeTest() throws Exception {
        Recipe recipe = store.createRecipe(new UriRef(
                "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());

    }
View Full Code Here

        log.debug("Created recipe with ID " + recipe.getRecipeID().toString());

    }

    private void addRuleToRecipeTest() throws Exception {
        Recipe recipe = store.getRecipe(new UriRef("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());

    }
View Full Code Here

        log.debug("Got recipe with ID " + recipe.getRecipeID().toString());

    }

    private void getRecipeTest() throws Exception {
        Recipe recipe = store.getRecipe(new UriRef("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());

    }
View Full Code Here

        log.debug("Got recipe with ID " + recipe.getRecipeID().toString());

    }

    private void getNotExistingRuleByNameInRecipeTest() throws Exception {
        Recipe recipe = store.getRecipe(new UriRef("http://incubator.apache.com/stanbol/rules/test/recipeA"));

        try {
            recipe.getRule("ruleX");
            Assert.fail();
        } catch (NoSuchRuleInRecipeException e) {
            Assert.assertTrue(true);
        }
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.