@Test public void testGetListForkedInvalidAll() { Statement testStatement1 = vf.createStatement(testListHeadBNode1, RDF.FIRST, testObjectLiteral1); this.testGraph.add(testStatement1); Statement testStatement2 = vf.createStatement(testListHeadBNode1, RDF.REST, testListHeadUri1); this.testGraph.add(testStatement2); Statement testStatement3 = vf.createStatement(testListHeadUri1, RDF.FIRST, testObjectUri1); this.testGraph.add(testStatement3); Statement testStatement4 = vf.createStatement(testListHeadUri1, RDF.REST, testListHeadBNode2); this.testGraph.add(testStatement4); Statement testStatement5 = vf.createStatement(testListHeadUri1, RDF.REST, testListHeadUri2); this.testGraph.add(testStatement5); try { final List<Value> results = this.testRdfListUtilDefaults.getList(this.testListHeadBNode1, this.testGraph); assertEquals("Returned results from an invalid list structure", 0, results.size()); fail("Did not find expected exception"); } catch (final RuntimeException rex) { assertEquals("List structure was not complete", rex.getMessage()); } }
public List<Value> getList(final Resource head, final Model graphToSearch, final Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); final Collection<List<Value>> results = this.getLists(Collections.singleton(head), graphToSearch, contexts); if (results.size() > 1) { throw new RuntimeException( "Found more than one list, possibly due to forking"); } if (results.size() == 1) { return results.iterator().next(); } return Collections.emptyList(); }
RdfListUtil { public List<Value> getList(final Resource head, final Model graphToSearch, final Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); final Collection<List<Value>> results = this.getLists(Collections.singleton(head), graphToSearch, contexts); if (results.size() > 1) { throw new RuntimeException( "Found more than one list, possibly due to forking"); } if (results.size() == 1) { return results.iterator().next(); } return Collections.emptyList(); } }
RdfListUtil { public List<Value> getList(final Resource head, final Model graphToSearch, final Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); final Collection<List<Value>> results = this.getLists(Collections.singleton(head), graphToSearch, contexts); if (results.size() > 1) { throw new RuntimeException( "Found more than one list, possibly due to forking"); } if (results.size() == 1) { return results.iterator().next(); } return Collections.emptyList(); } RdfListUtil();  RdfListUtil(boolean checkCycles, boolean checkIncomplete, boolean useIterativeOnError); }
RdfListUtil { public List<Value> getList(final Resource head, final Model graphToSearch, final Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); final Collection<List<Value>> results = this.getLists(Collections.singleton(head), graphToSearch, contexts); if (results.size() > 1) { throw new RuntimeException( "Found more than one list, possibly due to forking"); } if (results.size() == 1) { return results.iterator().next(); } return Collections.emptyList(); } RdfListUtil();  RdfListUtil(boolean checkCycles, boolean checkIncomplete, boolean useIterativeOnError); void addList(final Resource head,
                        final List<Value> nextValues,
                        final Model graphToAddTo,
                        final Resource... contexts); void addListAtNode(final Resource subject,
                              final IRI predicate, final List<Value> nextValues,
                              final Model graphToAddTo, final Resource... contexts); List<Value> getList(final Resource head,
                               final Model graphToSearch, final Resource... contexts); List<Value> getListAtNode(final Resource subject,
                                     final IRI predicate,
                                     final Model graphToSearch,
                                     final Resource... contexts); Collection<List<Value>> getListsIterative(final Set<Resource> heads,
                                                     final Model graphToSearch,
                                                     final Resource... contexts); Collection<List<Value>> getLists(final Set<Resource> heads,
                                            final Model graphToSearch,
                                            final Resource... contexts); Collection<List<Value>> getListsRecursive(final Resource head,
                                                     final Model graph,
                                                     final Resource... contexts); Collection<List<Value>> getListsAtNode(
            final Resource subject, final IRI predicate,
            final Model graphToSearch, final Resource... contexts); boolean getCheckCycles(); boolean getCheckIncomplete(); boolean getUseIterativeOnError(); }
RdfListUtil { public List<Value> getList(final Resource head, final Model graphToSearch, final Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); final Collection<List<Value>> results = this.getLists(Collections.singleton(head), graphToSearch, contexts); if (results.size() > 1) { throw new RuntimeException( "Found more than one list, possibly due to forking"); } if (results.size() == 1) { return results.iterator().next(); } return Collections.emptyList(); } RdfListUtil();  RdfListUtil(boolean checkCycles, boolean checkIncomplete, boolean useIterativeOnError); void addList(final Resource head,
                        final List<Value> nextValues,
                        final Model graphToAddTo,
                        final Resource... contexts); void addListAtNode(final Resource subject,
                              final IRI predicate, final List<Value> nextValues,
                              final Model graphToAddTo, final Resource... contexts); List<Value> getList(final Resource head,
                               final Model graphToSearch, final Resource... contexts); List<Value> getListAtNode(final Resource subject,
                                     final IRI predicate,
                                     final Model graphToSearch,
                                     final Resource... contexts); Collection<List<Value>> getListsIterative(final Set<Resource> heads,
                                                     final Model graphToSearch,
                                                     final Resource... contexts); Collection<List<Value>> getLists(final Set<Resource> heads,
                                            final Model graphToSearch,
                                            final Resource... contexts); Collection<List<Value>> getListsRecursive(final Resource head,
                                                     final Model graph,
                                                     final Resource... contexts); Collection<List<Value>> getListsAtNode(
            final Resource subject, final IRI predicate,
            final Model graphToSearch, final Resource... contexts); boolean getCheckCycles(); boolean getCheckIncomplete(); boolean getUseIterativeOnError(); final static boolean DEFAULT_CHECK_CYCLES; final static boolean DEFAULT_CHECK_INCOMPLETE; final static boolean DEFAULT_USE_ITERATIVE_ON_ERROR; }