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

Examples of org.apache.stanbol.rules.base.api.RuleAdapter.adaptTo()


        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) ]";
           
            //List<com.hp.hpl.jena.reasoner.rulesys.Rule> jenaRules = com.hp.hpl.jena.reasoner.rulesys.Rule.parseRules(rules);
            for(com.hp.hpl.jena.reasoner.rulesys.Rule jenaRule : jenaRules){
View Full Code Here


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

                RuleAdapter ruleAdapter = ruleAdapterManager.getAdapter(recipe, ConstructQuery.class);
                List<ConstructQuery> constructQueries = (List<ConstructQuery>) ruleAdapter.adaptTo(recipe,
                    ConstructQuery.class);

                MGraph mGraph = tcManager.createMGraph(refactoredOntologyID);
                for (ConstructQuery constructQuery : constructQueries) {
                    mGraph.addAll(this.sparqlConstruct(constructQuery, datasetID));
View Full Code Here

        try {
            recipe = ruleStore.getRecipe(recipeID);

            RuleAdapter ruleAdapter = ruleAdapterManager.getAdapter(recipe, ConstructQuery.class);

            List<ConstructQuery> constructQueries = (List<ConstructQuery>) ruleAdapter.adaptTo(recipe,
                ConstructQuery.class);

            unionMGraph = new SimpleMGraph();

            for (ConstructQuery constructQuery : constructQueries) {
View Full Code Here

    public TripleCollection graphRefactoring(TripleCollection inputGraph, Recipe recipe) throws RefactoringException {

        RuleAdapter ruleAdapter;
        try {
            ruleAdapter = ruleAdapterManager.getAdapter(recipe, ConstructQuery.class);
            List<ConstructQuery> constructQueries = (List<ConstructQuery>) ruleAdapter.adaptTo(recipe,
                ConstructQuery.class);

            for(ConstructQuery constructQuery : constructQueries){
                System.out.println(constructQuery.toString());
            }
View Full Code Here

                   * recipes into SWRLRule objects.
                   */
                  RuleAdapter adapter;
          try {
            adapter = adapterManager.getAdapter(recipe, SWRLRule.class);
            rules = (List<SWRLRule>) adapter.adaptTo(recipe, SWRLRule.class);
          } catch (UnavailableRuleObjectException e) {
            log.error(e.getMessage(), e);
          } catch (RuleAtomCallExeption e) {
            log.error(e.getMessage(), e);
          } catch (UnsupportedTypeForExportException e) {
View Full Code Here

                     * recipes into Jena Rule objects.
                     */
                    RuleAdapter adapter;
            try {
              adapter = adapterManager.getAdapter(recipe, Rule.class);
              jenaRules = (List<Rule>) adapter.adaptTo(recipe, Rule.class);
            } catch (UnavailableRuleObjectException e) {
              log.error(e.getMessage(), e);
            } catch (RuleAtomCallExeption e) {
              log.error(e.getMessage(), e);
            } catch (UnsupportedTypeForExportException e) {
View Full Code Here

      }
           
            Recipe rcp = ruleStore.getRecipe(new UriRef(recipe));
            RuleAdapter adapter = adapterManager.getAdapter(rcp, classToLoad);

            Object adaptedRecipe = adapter.adaptTo(rcp, classToLoad);

            JSONObject jsonObject = new JSONObject();
            try {
                jsonObject.put("recipe", rcp.getRecipeID().toString());
                jsonObject.put("adaptedTo", format);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.