@Override public void addRule(Rule rule) { ruleList.add(rule); }
public KB(String ruleNamespace) { log.debug("Setting up a KReSKB"); prefixes = new Hashtable<String,String>(); prefixes.put("var", Symbols.variablesPrefix); prefixes.put("rmi2", ruleNamespace); ruleList = new RuleList(); }
return true; for (int k=1; k<R.size(); k++) // 1 <= k < n
@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();
@SuppressWarnings("unchecked") @Override protected <T> T adaptRecipeTo(Recipe recipe, Class<T> type) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException { List<SWRLRule> swrlRules = null; if (type == SWRLRule.class) { RuleList ruleList = recipe.getRuleList(); swrlRules = new ArrayList<SWRLRule>(); if (ruleList != null && !ruleList.isEmpty()) { Iterator<Rule> ruleIterator = ruleList.iterator(); while (ruleIterator.hasNext()) { Rule rule = ruleIterator.next(); swrlRules.add(adaptRuleTo(rule, SWRLRule.class)); } } } else { throw new UnsupportedTypeForExportException( "The SPARQL Export Provider does not support the selected serialization : " + type.getCanonicalName()); } return (T) swrlRules; }
@SuppressWarnings("unchecked") protected <T> T adaptRecipeTo(Recipe recipe, Class<T> type) throws UnsupportedTypeForExportException, UnavailableRuleObjectException { List<SPARQLObject> sparqlObjects = null; if (type == SPARQLObject.class) { RuleList ruleList = recipe.getRuleList(); Iterator<Rule> ruleIterator = ruleList.iterator(); sparqlObjects = new ArrayList<SPARQLObject>(); for (int i = 0; ruleIterator.hasNext(); i++) { sparqlObjects.add((SPARQLObject) adaptRuleTo(ruleIterator.next(), type)); } } else { throw new UnsupportedTypeForExportException( "The SPARQL Export Provider does not support the selected serialization : " + type.getCanonicalName()); } return (T) sparqlObjects; }
if (subset.length == 1) { provenlist.add(subset.getFirst()); } else if (!i.hasNext()) { provenlist.add(subset.getFirst()); } else Key key = subset.combineRulesInListToKey() if (!doneKeys.containts(key)) { getProven(subset, provenlist, i);
/** * Create a new {@code RecipeImpl} from a set of rule expressed in KReS rule syntax. * * @param recipeID * @param recipeDescription * @param ruleList */ public RecipeImpl(IRI recipeID, String recipeDescription, RuleList ruleList) { this.recipeID = recipeID; this.recipeDescription = recipeDescription; if ( ruleList != null ) { this.ruleList.addAll( ruleList ); } }
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 IRI("http://sssw.org/2012/rules/"), "Recipe", kb.getRuleList());
@SuppressWarnings("unchecked") @Override protected <T> T adaptRecipeTo(Recipe recipe, Class<T> type) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException { List<ConstructQuery> constructQueries = null; 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)); } } else { throw new UnsupportedTypeForExportException( "The adapter for Clerezza does not support the selected serialization : " + type.getCanonicalName()); } return (T) constructQueries; }
/** * Create a new {@code RecipeImpl} from a set of rule expressed in KReS rule syntax. * * @param recipeID * @param recipeDescription * @param ruleList */ public RecipeImpl(IRI recipeID, String recipeDescription, RuleList ruleList) { this.recipeID = recipeID; this.recipeDescription = recipeDescription; if ( ruleList != null ) { this.ruleList.addAll( ruleList ); } }
log.debug("Recipe {} contains {} rules.", recipe, recipe.getRuleList().size()); log.debug("The ontology to be refactor is {}", ontology);
@SuppressWarnings("unchecked") @Override protected <T> T adaptRecipeTo(Recipe recipe, Class<T> type) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException { List<com.hp.hpl.jena.reasoner.rulesys.Rule> jenaRules = null; if (type == com.hp.hpl.jena.reasoner.rulesys.Rule.class) { RuleList ruleList = recipe.getRuleList(); Iterator<Rule> ruleIterator = ruleList.iterator(); jenaRules = new ArrayList<com.hp.hpl.jena.reasoner.rulesys.Rule>(); for (int i = 0; ruleIterator.hasNext(); i++) { jenaRules.add((com.hp.hpl.jena.reasoner.rulesys.Rule) adaptRuleTo(ruleIterator.next(), type)); } } else { throw new UnsupportedTypeForExportException( "The Jena Adapter does not support the selected serialization : " + type.getCanonicalName()); } return (T) jenaRules; }
@Override public void addRule(Rule rule) { ruleList.add(rule); }
public KB(String ruleNamespace) { log.debug("Setting up a KReSKB"); prefixes = new Hashtable<String,String>(); prefixes.put("var", Symbols.variablesPrefix); prefixes.put("rmi2", ruleNamespace); ruleList = new RuleList(); }