Skip to content

Commit

Permalink
Include inbound references in the node's RDF serialization by default
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed May 22, 2014
1 parent 8b51bd1 commit 4f6cce1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Expand Up @@ -260,8 +260,7 @@ public RdfStream describe(@PathParam("path") final List<PathSegment> pathList,
&& !contains(omits, LDP_NAMESPACE + "PreferContainment");


final boolean references = contains(includes, INBOUND_REFERENCES.toString())
&& !contains(omits, INBOUND_REFERENCES.toString());
final boolean references = !contains(omits, INBOUND_REFERENCES.toString());

final HierarchyRdfContextOptions hierarchyRdfContextOptions
= new HierarchyRdfContextOptions(limit, offset, membership, containment);
Expand Down
Expand Up @@ -132,6 +132,7 @@ public class FedoraNodesTest {
private RdfStream mockRdfStream = new RdfStream().topic(createAnon());

private RdfStream mockRdfStream2 = new RdfStream().topic(createAnon());
private RdfStream mockRdfStream3 = new RdfStream().topic(createAnon());

@Mock
private Model mockModel;
Expand Down Expand Up @@ -355,13 +356,14 @@ public void testDescribeObject() throws RepositoryException {
when(mockObject.getHierarchyTriples(any(IdentifierTranslator.class),
any(HierarchyRdfContextOptions.class))).thenReturn(
mockRdfStream2);
when(mockObject.getReferencesTriples(any(IdentifierTranslator.class))).thenReturn(mockRdfStream3);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
final Request mockRequest = mock(Request.class);
final RdfStream rdfStream =
testObj.describe(createPathList(path), 0, -2, null, mockRequest,
mockResponse, mockUriInfo);
assertEquals("Got wrong triples!", mockRdfStream.concat(mockRdfStream2),
assertEquals("Got wrong triples!", mockRdfStream.concat(mockRdfStream2).concat(mockRdfStream3),
rdfStream);
verify(mockResponse).addHeader("Accept-Patch", "application/sparql-update");
verify(mockResponse).addHeader("Link", "<" + LDP_NAMESPACE + "Resource>;rel=\"type\"");
Expand All @@ -382,14 +384,15 @@ public void testDescribeObjectNoInlining() throws RepositoryException, ParseExce
mockRdfStream);
when(mockObject.getHierarchyTriples(any(IdentifierTranslator.class),
any(HierarchyRdfContextOptions.class))).thenReturn(mockRdfStream2);
when(mockObject.getReferencesTriples(any(IdentifierTranslator.class))).thenReturn(mockRdfStream3);
when(mockNodes.getObject(isA(Session.class), isA(String.class)))
.thenReturn(mockObject);
final Request mockRequest = mock(Request.class);
final Prefer prefer = new Prefer("return=representation;"
+ "include=\"http://www.w3.org/ns/ldp#PreferEmptyContainer\"");
final RdfStream rdfStream =
testObj.describe(createPathList(path), 0, -1, prefer, mockRequest, mockResponse, mockUriInfo);
assertEquals("Got wrong RDF!", mockRdfStream.concat(mockRdfStream2),
assertEquals("Got wrong RDF!", mockRdfStream.concat(mockRdfStream2).concat(mockRdfStream3),
rdfStream);

}
Expand Down

0 comments on commit 4f6cce1

Please sign in to comment.