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

Examples of org.apache.stanbol.rules.base.api.util.RuleList


        if (type == ConstructQuery.class) {

            constructQueries = new ArrayList<ConstructQuery>();

            RuleList ruleList = recipe.getRuleList();
            Iterator<Rule> ruleIterator = ruleList.iterator();

            for (int i = 0; ruleIterator.hasNext(); i++) {
                constructQueries.add((ConstructQuery) adaptRuleTo(ruleIterator.next(), type));
            }
View Full Code Here


        }

    }

    private void findRulesByDescriptionTest() throws Exception {
        RuleList rules = store.findRulesByDescription("a test rule.");
        if (rules.isEmpty()) {
            Assert.fail();
        } else {
            Assert.assertTrue(true);
        }
    }
View Full Code Here

            Assert.assertTrue(true);
        }
    }

    private void findRulesByNameTest() throws Exception {
        RuleList rules = store.findRulesByName("1");

        if (rules.isEmpty()) {
            Assert.fail();
        } else {
            Assert.assertTrue(true);
        }
    }
View Full Code Here

    @Test
    public void testParser() {
        try {
            KB kReSKB = RuleParserImpl.parse("http://incubator.apache.org/stanbol/rules/test/", kReSRule);
            if (kReSKB != null) {
                RuleList kReSRuleList = kReSKB.getRuleList();
                if (kReSRuleList != null) {
                    for (Rule kReSRule : kReSRuleList) {
                        log.debug("RULE : " + kReSRule.toString());
                    }
                }
View Full Code Here

     * @throws RefactoringException
     */
    private OWLOntology doRefactoring(InputStream input, KB kb) throws OWLOntologyCreationException,
                                                               RefactoringException {
        if (kb == null) return null;
        RuleList ruleList = kb.getRuleList();
        if (ruleList == null) return null;
        Recipe actualRecipe = new RecipeImpl(null, null, ruleList);

        // Parse the input ontology
        OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
View Full Code Here

    @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/rules")
    public Response findRules(@QueryParam("name") String name, @QueryParam("description") String description) {
        RuleList rules = new RuleList();
        if (name != null && !name.isEmpty()) {
            rules.addAll(ruleStore.findRulesByName(name));
        } else {
            rules.addAll(ruleStore.findRulesByDescription(description));
        }

        if (rules.isEmpty()) {
            return Response.status(Status.NOT_FOUND).build();
        }

        return Response.ok(rules).build();
View Full Code Here

         
            recipe = ruleStore.getRecipe(new UriRef(recipeID));

            if (ruleID != null && !ruleID.isEmpty()) {
                rule = ruleStore.getRule(recipe, new UriRef(ruleID));
                RuleList ruleList = new RuleList();
                ruleList.add(rule);

                recipe = new RecipeImpl(recipe.getRecipeID(), recipe.getRecipeDescription(), ruleList);
            }

            responseBuilder = Response.ok(recipe);
View Full Code Here

     
            recipe = ruleStore.getRecipe(new UriRef(recipeID));

            if (ruleID != null && !ruleID.isEmpty()) {
                rule = ruleStore.getRule(recipe, new UriRef(ruleID));
                RuleList ruleList = new RuleList();
                ruleList.add(rule);

                recipe = new RecipeImpl(recipe.getRecipeID(), recipe.getRecipeDescription(), ruleList);
            }

            responseBuilder = Response.ok(new Viewable("rules", new RulesPrettyPrintResource(servletContext,
View Full Code Here

   
            OWLOntology ontology;
            try {
                ontology = manager.createOntology();
   
                RuleList rules = recipe.getRuleList();
   
                UriRef recipeID = recipe.getRecipeID();
   
                String recipeURI = recipeID.toString().replace("<", "").replace(">", "");
                IRI recipeIRI = IRI.create(recipeURI);
View Full Code Here

                        /**
                         * Create the Recipe object.
                         */

                        RuleList ruleList = RuleParserImpl.parse(kReSRulesInKReSSyntax).getkReSRuleList();
                        recipe = new RecipeImpl(recipeIRI, recipeDescription, ruleList);
                    } else {
                        throw new NoSuchRecipeException(recipeIRI);
                    }
                }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.base.api.util.RuleList

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.