Skip to content

Commit

Permalink
Use a separate preference to control embedding resources
Browse files Browse the repository at this point in the history
  • Loading branch information
cbeer committed Sep 26, 2014
1 parent 33abe97 commit 3ba5a09
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
Expand Up @@ -152,15 +152,15 @@ public Triple apply(final Statement input) {

rdfStream.concat(getTriples(ParentRdfContext.class));

if (ldpPreferences.prefersContainment() || ldpPreferences.prefersMembership()) {
if (ldpPreferences.prefersContainment()) {
rdfStream.concat(getTriples(ChildrenRdfContext.class));
}

if (ldpPreferences.prefersMembership()) {
rdfStream.concat(getTriples(LdpContainerRdfContext.class));
}

if (ldpPreferences.prefersContainment()) {
if (ldpPreferences.prefersEmbed()) {

final Iterator<FedoraResource> children = resource().getChildren();

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

import static com.google.common.base.Optional.fromNullable;
import static java.util.Arrays.asList;
import static org.fcrepo.kernel.RdfLexicon.EMBED_CONTAINS;
import static org.fcrepo.kernel.RdfLexicon.INBOUND_REFERENCES;
import static org.fcrepo.kernel.RdfLexicon.LDP_NAMESPACE;

Expand All @@ -42,6 +43,8 @@ public class LdpPreferTag extends PreferTag {

private final boolean preferMinimalContainer;

private final boolean embed;

/**
* Standard constructor.
*
Expand All @@ -65,6 +68,8 @@ public LdpPreferTag(final PreferTag preferTag) {
!omits.contains(LDP_NAMESPACE + "PreferContainment");

references = !omits.contains(INBOUND_REFERENCES.toString());

embed = includes.contains(EMBED_CONTAINS.toString());
}

/**
Expand All @@ -87,4 +92,10 @@ public boolean prefersContainment() {
public boolean prefersReferences() {
return references;
}
/**
* @return Whether this prefer tag demands references triples.
*/
public boolean prefersEmbed() {
return embed;
}
}
Expand Up @@ -304,6 +304,7 @@ public final class RdfLexicon {
public static final Property COULD_NOT_STORE_PROPERTY =
createProperty(REPOSITORY_NAMESPACE + "couldNotStoreProperty");
public static final Property INBOUND_REFERENCES = createProperty(REPOSITORY_NAMESPACE + "InboundReferences");
public static final Property EMBED_CONTAINS = createProperty(REPOSITORY_NAMESPACE + "EmbedResources");

// IMPORTANT JCR PROPERTIES
public static final Property HAS_PRIMARY_IDENTIFIER =
Expand Down

0 comments on commit 3ba5a09

Please sign in to comment.