/** * Returns a tree representations of the service input class. * * @return a tree representations of the service input class * @throws IOException * @throws SADIException */ public RestrictionNode getInputRestrictionTree() throws SADIException, IOException { if (inputRestrictionTree == null) { inputRestrictionTree = SADIUtils .buildInputRestrictionTree(getService().getInputClass()); } return inputRestrictionTree; }
/** * Returns a tree representations of the service output class. * * @return a tree representations of the service output class * @throws IOException * @throws SADIException */ public RestrictionNode getOutputRestrictionTree() throws SADIException, IOException { if (outputRestrictionTree == null) { outputRestrictionTree = SADIUtils.buildOutputRestrictionTree(getService() .getInputClass(), getService().getOutputClass()); } return outputRestrictionTree; }
@Test public void testGetInputResources4() throws Exception { String serviceURI = "http://sadiframework.org/services/getKEGGIDFromUniProt"; String serviceId = serviceURI + UUID.randomUUID(); Service service = new ServiceImpl(serviceURI); List<String> uniprot = Arrays.asList("P68871", "Q7Z591"); RestrictionNode inputRestrictionTree = SADIUtils.buildInputRestrictionTree(service.getInputClass()); for (List<String> path : SADIUtils.getDefaultRestrictionPaths(inputRestrictionTree)) { RestrictionNode restriction = SADIUtils.getRestriction(inputRestrictionTree, path); restriction.setSelected(); } RestrictionNode firstLeaf = (RestrictionNode) inputRestrictionTree.getFirstLeaf(); firstLeaf.setValues(serviceId, uniprot); Collection<Resource> inputResources = SADIUtils.getInputResources(inputRestrictionTree, serviceId); System.out.println(inputResources); Collection<Triple> outputs = service.invokeService(inputResources); for (Triple triple : outputs) { System.out.println(triple); } }
@Test @Ignore(value="service fails") public void testGetInputResources3() throws Exception { String serviceURI = "http://sadiframework.org/services/getMolecularInteractions"; String serviceId = serviceURI + UUID.randomUUID(); Service service = new ServiceImpl(serviceURI); List<String> uniprot = Arrays.asList("P68871", "Q7Z591"); RestrictionNode inputRestrictionTree = SADIUtils.buildInputRestrictionTree(service.getInputClass()); for (List<String> path : SADIUtils.getDefaultRestrictionPaths(inputRestrictionTree)) { RestrictionNode restriction = SADIUtils.getRestriction(inputRestrictionTree, path); restriction.setSelected(); } RestrictionNode firstLeaf = (RestrictionNode) inputRestrictionTree.getFirstLeaf(); firstLeaf.setValues(serviceId, uniprot); Collection<Resource> inputResources = SADIUtils.getInputResources(inputRestrictionTree, serviceId); System.out.println(inputResources); Collection<Triple> outputs = service.invokeService(inputResources); for (Triple triple : outputs) { System.out.println(triple); } }
@Test public void testGetInputResources2() throws Exception { String serviceURI = "http://sadiframework.org/examples/uniprotInfo"; String serviceId = serviceURI + UUID.randomUUID(); Service service = new ServiceImpl(serviceURI); List<String> uniprot = Arrays.asList("P68871", "Q7Z591"); RestrictionNode inputRestrictionTree = SADIUtils.buildInputRestrictionTree(service.getInputClass()); for (List<String> path : SADIUtils.getDefaultRestrictionPaths(inputRestrictionTree)) { RestrictionNode restriction = SADIUtils.getRestriction(inputRestrictionTree, path); restriction.setSelected(); } RestrictionNode firstLeaf = (RestrictionNode) inputRestrictionTree.getFirstLeaf(); firstLeaf.setValues(serviceId, uniprot); Collection<Resource> inputResources = SADIUtils.getInputResources(inputRestrictionTree, serviceId); Collection<Triple> outputs = service.invokeService(inputResources); for (Triple triple : outputs) { System.out.println(triple); } }
RestrictionNode node = SADIUtils.buildInputRestrictionTree(service.getInputClass()); for (List<String> path : SADIUtils.getDefaultRestrictionPaths(node)) { RestrictionNode restriction = SADIUtils.getRestriction(node, path); RestrictionNode outputNode = SADIUtils.buildOutputRestrictionTree(service.getInputClass(), service.getOutputClass()); SADIUtils.putOutputResources(outputNode, outputs, inputResources, serviceId); SADIUtils.printTreeValues(serviceId, outputNode);
List<List<String>> value = listOfLists("3", "5"); RestrictionNode inputRestrictionTree = SADIUtils.buildInputRestrictionTree(service.getInputClass()); Map<String, RestrictionNode> map = new HashMap<String, RestrictionNode>(); RestrictionNode leaf = (RestrictionNode) inputRestrictionTree.getFirstLeaf();