throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName());
log.error(e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { log.error(e.getMessage(), e); log.error(e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { log.error(e.getMessage(), e);
} catch (UnsupportedTypeForExportException e) { e.printStackTrace();
} catch (UnsupportedTypeForExportException e) { responseBuilder = Response.status(Status.FORBIDDEN); log.error(e.getMessage(), e); } catch (URISyntaxException e) { responseBuilder = Response.status(Status.NOT_ACCEPTABLE);
@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 public Graph graphRefactoring(Graph 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()); } Graph unionGraph = new SimpleGraph(); for (ConstructQuery constructQuery : constructQueries) { unionGraph.addAll(sparqlConstruct(constructQuery, inputGraph)); } return unionGraph; } catch (UnavailableRuleObjectException e) { throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e); } catch (RuleAtomCallExeption e) { throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e); } }
throw new UnsupportedTypeForExportException("The adapter " + getClass() + " does not support type : " + type.getCanonicalName());
} catch (UnsupportedTypeForExportException e) { throw new RefactoringException( "The cause of the refactoring excpetion is: " + e.getMessage(), e); } catch (RuleAtomCallExeption e) { throw new RefactoringException(
@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; }
throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e); } catch (RuleAtomCallExeption e) { throw new RefactoringException("The cause of the refactoring excpetion is: " + e.getMessage(), e);
@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());