Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Non-function update: Replace LDP namespace strings with constants
  • Loading branch information
Andrew Woods committed Feb 17, 2014
1 parent 17a0500 commit 7e213cf
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Expand Up @@ -47,6 +47,7 @@
import static org.fcrepo.jcr.FedoraJcrTypes.FEDORA_DATASTREAM;
import static org.fcrepo.jcr.FedoraJcrTypes.FEDORA_OBJECT;
import static org.fcrepo.kernel.RdfLexicon.FIRST_PAGE;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.NEXT_PAGE;
import static org.fcrepo.kernel.rdf.GraphProperties.PROBLEMS_MODEL_NAME;
import static org.slf4j.LoggerFactory.getLogger;
Expand Down Expand Up @@ -218,8 +219,7 @@ public RdfStream describe(@PathParam("path") final List<PathSegment> pathList,
.getLastModifiedDate().getTime());
}
servletResponse.addHeader("Accept-Patch", contentTypeSPARQLUpdate);
servletResponse.addHeader("Link",
"http://www.w3.org/ns/ldp#Resource;rel=\"type\"");
servletResponse.addHeader("Link", LDP_NAMESPACE + "Resource;rel=\"type\"");

addResponseInformationToStream(resource, rdfStream, uriInfo,
subjects);
Expand Down
Expand Up @@ -29,6 +29,7 @@
import static org.fcrepo.http.commons.test.util.TestHelpers.setField;
import static org.fcrepo.jcr.FedoraJcrTypes.FEDORA_DATASTREAM;
import static org.fcrepo.jcr.FedoraJcrTypes.FEDORA_OBJECT;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;
import static org.fcrepo.kernel.rdf.GraphProperties.PROBLEMS_MODEL_NAME;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
Expand Down Expand Up @@ -327,7 +328,7 @@ public void testDescribeObject() throws RepositoryException {
assertEquals("Got wrong triples!", mockRdfStream.concat(mockRdfStream2),
rdfStream);
verify(mockResponse).addHeader("Accept-Patch", "application/sparql-update");
verify(mockResponse).addHeader("Link", "http://www.w3.org/ns/ldp#Resource;rel=\"type\"");
verify(mockResponse).addHeader("Link", LDP_NAMESPACE + "Resource;rel=\"type\"");

}

Expand Down
Expand Up @@ -42,6 +42,7 @@
import static org.fcrepo.kernel.RdfLexicon.HAS_OBJECT_SIZE;
import static org.fcrepo.kernel.RdfLexicon.HAS_PRIMARY_IDENTIFIER;
import static org.fcrepo.kernel.RdfLexicon.HAS_PRIMARY_TYPE;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.fcrepo.kernel.utils.FedoraTypesUtils.map;
import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -345,13 +346,13 @@ public String apply(final Header h) {
}
});
assertTrue("Didn't find LDP link header!", links
.contains("http://www.w3.org/ns/ldp#Resource;rel=\"type\""));
.contains(LDP_NAMESPACE + "Resource;rel=\"type\""));
final GraphStore results = getGraphStore(getObjMethod);
final Model model = createModelForGraph(results.getDefaultGraph());

final Resource nodeUri = createResource(serverAddress + pid);
assertTrue("Didn't find inlined resources!", model.contains(nodeUri,
createProperty("http://www.w3.org/ns/ldp#inlinedResource")));
createProperty(LDP_NAMESPACE + "inlinedResource")));

assertTrue("Didn't find an expected triple!", model.contains(nodeUri,
createProperty(REPOSITORY_NAMESPACE + "mixinTypes"),
Expand Down Expand Up @@ -398,7 +399,7 @@ public String apply(final Header h) {
return h.getValue();
}
});
assertTrue("Didn't find LDP link header!", links.contains("http://www.w3.org/ns/ldp#Resource;rel=\"type\""));
assertTrue("Didn't find LDP link header!", links.contains(LDP_NAMESPACE + "Resource;rel=\"type\""));
}

@Test
Expand All @@ -419,7 +420,7 @@ public void testGetObjectGraphNonMemberProperties() throws Exception {
compile(
"<"
+ serverAddress
+ "FedoraDescribeTestGraph> <http://www.w3.org/ns/ldp#inlinedResource>",
+ "FedoraDescribeTestGraph> <" + LDP_NAMESPACE + "inlinedResource>",
DOTALL).matcher(content).find());

}
Expand Down
Expand Up @@ -18,6 +18,7 @@

import static com.google.common.base.Throwables.propagate;
import static org.fcrepo.kernel.RdfLexicon.COULD_NOT_STORE_PROPERTY;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;
import static org.slf4j.LoggerFactory.getLogger;

import javax.jcr.NamespaceException;
Expand Down Expand Up @@ -111,7 +112,7 @@ public void addedStatement(final Statement s) {
&& s.getObject().isResource()) {
final Resource mixinResource = s.getObject().asResource();

if (mixinResource.getNameSpace().equals("http://www.w3.org/ns/ldp#")) {
if (mixinResource.getNameSpace().equals(LDP_NAMESPACE)) {
return;
}

Expand Down
Expand Up @@ -43,6 +43,7 @@
import static org.fcrepo.kernel.RdfLexicon.HAS_SIZE;
import static org.fcrepo.kernel.RdfLexicon.HAS_VERSION;
import static org.fcrepo.kernel.RdfLexicon.HAS_VERSION_LABEL;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.fcrepo.kernel.rdf.JcrRdfTools.getJcrNamespaceForRDFNamespace;
import static org.fcrepo.kernel.rdf.JcrRdfTools.getRDFNamespaceForJcrNamespace;
Expand Down Expand Up @@ -266,7 +267,7 @@ public final void shouldExcludeBinaryProperties() throws RepositoryException,

final Model actual = testObj.getTreeTriples(mockNode).asModel();
assertEquals(0, Iterators.size(actual.listObjectsOfProperty(actual
.createProperty("http://www.w3.org/ns/ldp#inlinedResource"))));
.createProperty(LDP_NAMESPACE + "inlinedResource"))));
verify(mockParent, never()).getProperties();
verify(mockNode, never()).getNodes();
}
Expand All @@ -291,24 +292,24 @@ public final void shouldIncludeContainerInfoWithMixinTypeContainer()
final Model actual = testObj.getTreeTriples(mockNode).asModel();

assertTrue(actual.contains(testSubjects.getContext(), type, actual
.createProperty("http://www.w3.org/ns/ldp#Page")));
.createProperty(LDP_NAMESPACE + "Page")));
assertTrue(actual.contains(testSubjects.getContext(), actual
.createProperty("http://www.w3.org/ns/ldp#membersInlined"),
.createProperty(LDP_NAMESPACE + "membersInlined"),
actual.createLiteral(TRUE.toString())));

final Resource graphSubject = testSubjects.getGraphSubject(mockNode);
assertTrue(actual.contains(graphSubject, type, actual
.createProperty("http://www.w3.org/ns/ldp#Container")));
.createProperty(LDP_NAMESPACE + "Container")));

assertTrue(actual.contains(graphSubject, actual
.createProperty("http://www.w3.org/ns/ldp#membershipSubject"),
.createProperty(LDP_NAMESPACE + "membershipSubject"),
graphSubject));
assertTrue(actual.contains(graphSubject,actual
.createProperty("http://www.w3.org/ns/ldp#membershipPredicate"),
.createProperty(LDP_NAMESPACE + "membershipPredicate"),
HAS_CHILD));
assertTrue(actual.contains(graphSubject,actual
.createProperty("http://www.w3.org/ns/ldp#membershipObject"),
actual.createResource("http://www.w3.org/ns/ldp#MemberSubject")));
.createProperty(LDP_NAMESPACE + "membershipObject"),
actual.createResource(LDP_NAMESPACE + "MemberSubject")));
}

@Test
Expand Down Expand Up @@ -536,7 +537,7 @@ public final void testIsInternalProperty() throws Exception {
assertTrue(testObj.isInternalProperty(mockNode, createProperty(
"http://www.jcp.org/jcr/1.0", "some-property")));
assertTrue(testObj.isInternalProperty(mockNode,
createProperty("http://www.w3.org/ns/ldp#some-property")));
createProperty(LDP_NAMESPACE + "some-property")));
assertFalse(testObj
.isInternalProperty(
mockNode,
Expand Down

1 comment on commit 7e213cf

@ajs6f
Copy link
Contributor

@ajs6f ajs6f commented on 7e213cf Feb 17, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I don't think we want to go to the length of constant-izing the actual terms, especially when the spec is changing underneath us.

Please sign in to comment.