Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
actually, continue to not count jcr:content as a child node. it's too…
… confusing.
  • Loading branch information
cbeer committed May 13, 2013
1 parent 887fb2f commit d0b7c26
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Expand Up @@ -166,6 +166,7 @@ private static void addJcrTreePropertiesToModel(final Node node, final Model mod

final javax.jcr.NodeIterator nodeIterator = node.getNodes();

long excludedNodes = 0L;
while (nodeIterator.hasNext()) {
final Node childNode = nodeIterator.nextNode();
final Resource childNodeSubject = getGraphSubject(childNode);
Expand All @@ -174,6 +175,7 @@ private static void addJcrTreePropertiesToModel(final Node node, final Model mod

if (childNode.getName().equals(JcrConstants.JCR_CONTENT)) {
model.add(subject, model.createProperty("info:fedora/fedora-system:def/internal#hasContent"), childNodeSubject);
excludedNodes += 1;
} else {
model.add(subject, model.createProperty("info:fedora/fedora-system:def/internal#hasChild"), childNodeSubject);
}
Expand All @@ -185,7 +187,7 @@ private static void addJcrTreePropertiesToModel(final Node node, final Model mod

}

model.add(subject, model.createProperty("info:fedora/fedora-system:def/internal#numberOfChildren"), ResourceFactory.createTypedLiteral(nodeIterator.getSize()));
model.add(subject, model.createProperty("info:fedora/fedora-system:def/internal#numberOfChildren"), ResourceFactory.createTypedLiteral(nodeIterator.getSize() - excludedNodes));
}

/**
Expand Down
Expand Up @@ -127,8 +127,8 @@ public void testDatastreamGraph() throws IOException, RepositoryException, Inval

// structure
p = Node.createURI("info:fedora/fedora-system:def/internal#numberOfChildren");
RDFDatatype long_datatype = ResourceFactory.createTypedLiteral(1L).getDatatype();
o = Node.createLiteral("1", long_datatype);
RDFDatatype long_datatype = ResourceFactory.createTypedLiteral(0L).getDatatype();
o = Node.createLiteral("0", long_datatype);

assertTrue(object.getGraphStore().getDefaultGraph().contains(s, p, o));
// relations
Expand Down

0 comments on commit d0b7c26

Please sign in to comment.