throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName());
throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName());
@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; }
@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; }
@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; }
@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") @Override protected <T> T adaptRuleTo(Rule rule, Class<T> type) throws RuleAtomCallExeption, UnsupportedTypeForExportException, UnavailableRuleObjectException { if (type == SWRLRule.class) { OWLDataFactory factory = OWLManager.getOWLDataFactory(); Set<SWRLAtom> bodyAtoms = new HashSet<SWRLAtom>(); Set<SWRLAtom> headAtoms = new HashSet<SWRLAtom>(); for (RuleAtom atom : rule.getBody()) { bodyAtoms.add((SWRLAtom) adaptRuleAtomTo(atom, SWRLRule.class)); } for (RuleAtom atom : rule.getHead()) { headAtoms.add((SWRLAtom) adaptRuleAtomTo(atom, SWRLRule.class)); } return (T) factory.getSWRLRule(bodyAtoms, headAtoms); } else { throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName()); } }
bodyClauseEntries); } else { throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName());