Skip to content
Permalink
Browse files

Use IANA describes/describedby predicates to link a non-rdf source an…

…d its description
  • Loading branch information...
cbeer committed Oct 30, 2014
1 parent bc44e2d commit 3ad9b11595ef18fbd5daa1cf110f0e268ffe5fa1
@@ -1,4 +1,4 @@
#set ($content = $helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.HAS_CONTENT, false))
#set ($content = $helpers.getObjectsAsString($rdf, $topic, $rdfLexicon.DESCRIBES, false))
#set ($writable = $helpers.isWritable($rdf, $topic))
#set ($frozen = $helpers.isFrozenNode($rdf, $topic))

@@ -25,7 +25,7 @@
import static org.fcrepo.kernel.RdfLexicon.LAST_MODIFIED_DATE;
import static org.fcrepo.kernel.RdfLexicon.RDFS_LABEL;
import static org.fcrepo.kernel.RdfLexicon.HAS_VERSION;
import static org.fcrepo.kernel.RdfLexicon.HAS_CONTENT;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBES;
import static org.fcrepo.kernel.RdfLexicon.RDF_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.DC_NAMESPACE;
import static org.slf4j.LoggerFactory.getLogger;
@@ -118,7 +118,7 @@ public static ViewHelpers getInstance() {
*/
public Iterator<Node> getChildVersions(final Graph graph,
final Node subject) {
return getOrderedVersions(graph, subject, HAS_CONTENT);
return getOrderedVersions(graph, subject, DESCRIBES);
}

/**
@@ -31,7 +31,7 @@
import static org.fcrepo.kernel.RdfLexicon.DC_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.LAST_MODIFIED_DATE;
import static org.fcrepo.kernel.RdfLexicon.HAS_VERSION;
import static org.fcrepo.kernel.RdfLexicon.HAS_CONTENT;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBES;
import static org.fcrepo.kernel.RdfLexicon.RDFS_LABEL;
import static org.fcrepo.kernel.RdfLexicon.REPOSITORY_NAMESPACE;
import static org.fcrepo.kernel.RdfLexicon.WRITABLE;
@@ -120,7 +120,7 @@ public void testGetChildVersions() {
final Node contentVersion = createURI("http://localhost/fcrepo/abc/fcr:version/adcd/fcr:content");
final String date = new Date().toString();
mem.add(new Triple(version, HAS_VERSION.asNode(), version));
mem.add(new Triple(version, HAS_CONTENT.asNode(), contentVersion));
mem.add(new Triple(version, DESCRIBES.asNode(), contentVersion));
mem.add(new Triple(contentVersion, LAST_MODIFIED_DATE.asNode(), createLiteral(date)));
assertEquals("Content version should be available.",
contentVersion, testObj.getChildVersions(mem, version).next());
@@ -169,7 +169,7 @@ public void testIsWritableFalse() {
@Test
public void testIsWritableFalseJunk() {
final Graph mem = createDefaultModel().getGraph();
mem.add(new Triple(createURI("a/b/c"), HAS_CONTENT.asNode(), createLiteral("junk")));
mem.add(new Triple(createURI("a/b/c"), DESCRIBES.asNode(), createLiteral("junk")));
assertFalse("Node should not be writable.", testObj.isWritable(mem, createURI("a/b/c")));
}

@@ -16,8 +16,8 @@
package org.fcrepo.kernel.impl.rdf.impl;

import static com.hp.hpl.jena.graph.Triple.create;
import static org.fcrepo.kernel.RdfLexicon.HAS_CONTENT;
import static org.fcrepo.kernel.RdfLexicon.IS_CONTENT_OF;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBES;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBED_BY;

import org.fcrepo.kernel.models.NonRdfSourceDescription;
import org.fcrepo.kernel.models.FedoraBinary;
@@ -49,12 +49,12 @@ public ContentRdfContext(final FedoraResource resource,
final Node subject = translator().reverse().convert(resource()).asNode();
final Node contentSubject = translator().reverse().convert(contentNode).asNode();
// add triples representing parent-to-content-child relationship
concat(create(subject, HAS_CONTENT.asNode(), contentSubject));
concat(create(subject, DESCRIBES.asNode(), contentSubject));

} else if (resource instanceof FedoraBinary) {
final FedoraResource description = ((FedoraBinary) resource).getDescription();
concat(create(translator().reverse().convert(resource).asNode(),
IS_CONTENT_OF.asNode(),
DESCRIBED_BY.asNode(),
translator().reverse().convert(description).asNode()));
}
}
@@ -15,8 +15,8 @@
*/
package org.fcrepo.kernel.impl.rdf.impl;

import static org.fcrepo.kernel.RdfLexicon.HAS_CONTENT;
import static org.fcrepo.kernel.RdfLexicon.IS_CONTENT_OF;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBES;
import static org.fcrepo.kernel.RdfLexicon.DESCRIBED_BY;
import static org.fcrepo.kernel.RdfLexicon.JCR_NAMESPACE;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
@@ -60,7 +60,7 @@ public void testForLowLevelStorageTriples() throws IOException {
new ContentRdfContext(mockResource, idTranslator).asModel();
logRdf("Retrieved RDF for testForLowLevelStorageTriples():", results);
assertTrue("Didn't find triple showing node has content!", results
.contains(mockSubject, HAS_CONTENT, mockContentSubject));
.contains(mockSubject, DESCRIBES, mockContentSubject));
}

@Test
@@ -69,7 +69,7 @@ public void testFedoraBinaryTriples() throws IOException {
final Model results =
new ContentRdfContext(mockBinary, idTranslator).asModel();
assertTrue("Didn't find triple showing content has node!", results
.contains(mockContentSubject, IS_CONTENT_OF, mockSubject));
.contains(mockContentSubject, DESCRIBED_BY, mockSubject));
}

@Before
@@ -239,11 +239,15 @@
HAS_FEED, HAS_SUBSCRIPTION_SERVICE);


// BINARY DESCRIPTIONS
public static final Property DESCRIBES =
createProperty("http://www.iana.org/assignments/relation/describes");
public static final Property DESCRIBED_BY =
createProperty("http://www.iana.org/assignments/relation/describedby");

public static final Set<Property> structProperties = of(DESCRIBES, DESCRIBED_BY);

// CONTENT
public static final Property HAS_CONTENT =
createProperty(REPOSITORY_NAMESPACE + "hasContent");
public static final Property IS_CONTENT_OF =
createProperty(REPOSITORY_NAMESPACE + "isContentOf");
public static final Resource CONTENT_LOCATION_TYPE =
createResource(PREMIS_NAMESPACE + "ContentLocation");
public static final Property HAS_CONTENT_LOCATION =
@@ -255,8 +259,7 @@
public static final Property HAS_ORIGINAL_NAME =
createProperty(PREMIS_NAMESPACE + "hasOriginalName");

public static final Set<Property> contentProperties = of(HAS_CONTENT,
IS_CONTENT_OF, HAS_CONTENT_LOCATION, HAS_CONTENT_LOCATION_VALUE,
public static final Set<Property> contentProperties = of(HAS_CONTENT_LOCATION, HAS_CONTENT_LOCATION_VALUE,
HAS_MIME_TYPE, HAS_ORIGINAL_NAME, HAS_SIZE);


@@ -310,7 +313,7 @@
final ImmutableSet.Builder<Property> b = ImmutableSet.builder();
b.addAll(membershipProperties).addAll(fixityProperties).addAll(ldpProperties).addAll(
repositoryProperties).addAll(namespaceProperties).addAll(
otherServiceProperties).addAll(contentProperties).addAll(
otherServiceProperties).addAll(structProperties).addAll(contentProperties).addAll(
versioningProperties).addAll(jcrProperties);
managedProperties = b.build();
}

0 comments on commit 3ad9b11

Please sign in to comment.
You can’t perform that action at this time.