@SuppressWarnings("unchecked") protected <T> T adaptRuleAtomTo(RuleAtom ruleAtom, Class<T> type) throws UnsupportedTypeForExportException, UnavailableRuleObjectException { if (type == SPARQLObject.class) { String className = ruleAtom.getClass().getSimpleName(); String canonicalName = ARTIFACT + "." + className; try { Class<AdaptableAtom> sparqlAtomClass = (Class<AdaptableAtom>) Class.forName(canonicalName); try { AdaptableAtom sparqlAtom = sparqlAtomClass.newInstance(); sparqlAtom.setRuleAdapter(this); return (T) sparqlAtom.adapt(ruleAtom); } catch (InstantiationException e) { log.error(e.getMessage(), e); } catch (IllegalAccessException e) { log.error(e.getMessage(), e); } catch (RuleAtomCallExeption e) { log.error(e.getMessage(), e); } } catch (ClassNotFoundException e) { log.error(e.getMessage(), e); } catch (SecurityException e) { log.error(e.getMessage(), e); } } return null; }
log.error(e.getMessage(), e); } catch (RuleAtomCallExeption e) { log.error(e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { log.error(e.getMessage(), e); log.error(e.getMessage(), e); } catch (RuleAtomCallExeption e) { log.error(e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { log.error(e.getMessage(), e);
} catch (RuleAtomCallExeption e) { responseBuilder = Response.status(Status.CONFLICT); log.error(e.getMessage(), e); } catch (UnsupportedTypeForExportException e) { responseBuilder = Response.status(Status.FORBIDDEN);
@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); } }
} catch (RuleAtomCallExeption e) { throw new RefactoringException( "The cause of the refactoring excpetion is: " + e.getMessage(), 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);