Package org.apache.stanbol.rules.manager.changes

Examples of org.apache.stanbol.rules.manager.changes.RemoveRule


                    addCORSOrigin(servletContext, rb, headers);
                    return rb.build();
                }

                // Remove rule from recipe
                RemoveRule remove = new RemoveRule(ruleStore);
                ok = remove.removeRuleFromRecipe(IRI.create(rule), IRI.create(recipe));

                if (ok) {
                    ruleStore.saveOntology();
                    ResponseBuilder rb = Response.ok();
                    rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
                    addCORSOrigin(servletContext, rb, headers);
                    return rb.build();
                } else {
                    ResponseBuilder rb = Response.status(Status.NO_CONTENT);
                    rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
                    addCORSOrigin(servletContext, rb, headers);
                    return rb.build();
                }
            }

            // Delete from the ontology
            if ((recipe == null) && (rule != null)) {
                rule = rule.replace(" ", "").trim();
                // Get the rule
                GetRule getrule = new GetRule(ruleStore);
                this.map = getrule.getRule(IRI.create(rule));
                if (map == null) {
                    ResponseBuilder rb = Response.status(Status.NOT_FOUND);
                    rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
                    addCORSOrigin(servletContext, rb, headers);
                    return rb.build();
                }

                // Remove the old rule
                RemoveRule remove = new RemoveRule(ruleStore);
                ok = remove.removeRule(IRI.create(rule));
                if (ok) {
                    ruleStore.saveOntology();
                    ResponseBuilder rb = Response.ok();
                    rb.header(HttpHeaders.CONTENT_TYPE, TEXT_HTML + "; charset=utf-8");
                    addCORSOrigin(servletContext, rb, headers);
View Full Code Here


        LoadRuleFile load = new LoadRuleFile("./src/main/resources/RuleOntology/TestRuleFileExample.txt",
                store);
        AddRule rule = new AddRule(load.getStore());
        rule.addRule("MyRuleProva", "Body -> Head", null);
        String ruleName = "MyRuleProva";
        RemoveRule instance = new RemoveRule(rule.getStore());
        boolean expResult = true;
        boolean result = instance.removeRule(ruleName);
        if (result) {
            assertEquals(expResult, result);
            // TODO review the generated test code and remove the default call to fail.
        } else {
            fail("Some errors occur with removeRule of KReSRemoveRule.");
View Full Code Here

        // Load the example file
        LoadRuleFile load = new LoadRuleFile("./src/main/resources/RuleOntology/TestRuleFileExample.txt",
                store);
        IRI rule = IRI.create(owlID + "MyRuleB");
        IRI recipe = IRI.create(owlID + "MyRecipe");
        RemoveRule instance = new RemoveRule(load.getStore());
        boolean expResult = true;
        boolean result = instance.removeRuleFromRecipe(rule, recipe);

        if (result) {
            assertEquals(expResult, result);
            // TODO review the generated test code and remove the default call to fail.
        } else {
View Full Code Here

TOP

Related Classes of org.apache.stanbol.rules.manager.changes.RemoveRule

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.