diff --git a/cli/README.md b/cli/README.md
index 03d688a0c..fbdd09093 100644
--- a/cli/README.md
+++ b/cli/README.md
@@ -164,6 +164,17 @@ topic — it would entail that the two topics are the same resource. It writes t
topic's own type and properties are the constructor's business, and a vocabulary may refuse a topic
without them (the taxonomy editor package rejects a concept with no `skos:inScheme`).
+A container's first content block shows its children, as the `dh:Container` constructor makes it.
+`--no-children-view` leaves it out, and the content is then appended like any other document's. A
+container whose children are laid out in another mode embeds its own view:
+
+```bash
+container=$(ldh create container --parent "$LDH_BASE" --title "Products" --slug products --no-children-view)
+ldh add view --uri '#children' --query https://w3id.org/atomgraph/linkeddatahub#SelectChildren \
+ --mode https://w3id.org/atomgraph/client#GridMode --title "Products" "$container"
+ldh add object-block --value "${container}#children" "$container"
+```
+
## Conventions
- Commands that create or append to a document print its URL as the only line on stdout, so shell
@@ -372,6 +383,9 @@ Local certificate tooling (`webid-keygen.sh`, `webid-keygen-pem.sh`, `webid-uri.
- `create item`/`create container` add `--primary-topic`, which the scripts have no equivalent for:
they could only create a document that says nothing about what it is about, leaving a `patch` as
the only way to assert it.
+- `create container` has no `--block` or `--mode`. The script's `--block` wrote a bare `rdf:_1`,
+ which the platform rejects, and its `--mode` built a children view in place; `--no-children-view`
+ followed by `add view` and `add object-block` builds the same content (see above).
- `push` replaces the apps' `update-folder.sh` together with the `root.ttl` step of their
`install.sh`: `root.ttl` maps to the target document, so it needs neither the separate `put` nor
its `.ldhignore` entry. `.ldhignore` applies to the whole subtree, as the apps documentation
diff --git a/cli/src/main/java/com/atomgraph/linkeddatahub/cli/command/CreateContainer.java b/cli/src/main/java/com/atomgraph/linkeddatahub/cli/command/CreateContainer.java
index 6054bc426..57137a5bf 100644
--- a/cli/src/main/java/com/atomgraph/linkeddatahub/cli/command/CreateContainer.java
+++ b/cli/src/main/java/com/atomgraph/linkeddatahub/cli/command/CreateContainer.java
@@ -45,11 +45,8 @@ public class CreateContainer extends BaseCommand
@Option(names = "--parent", required = true, paramLabel = "PARENT_URI", description = "URI of the parent container")
private URI parent;
- @Option(names = "--block", paramLabel = "BLOCK_URI", description = "URI of the content block (optional)")
- private URI block;
-
- @Option(names = "--mode", paramLabel = "MODE_URI", description = "URI of the layout mode of the children view (optional)")
- private URI mode;
+ @Option(names = "--children-view", negatable = true, defaultValue = "true", fallbackValue = "true", description = "Whether the first content block shows the container's children (default: ${DEFAULT-VALUE})")
+ private boolean childrenView;
@Option(names = "--primary-topic", paramLabel = "URI", description = "URI of what the document is about, resolved against the document URI (optional)")
private String primaryTopic;
@@ -58,7 +55,7 @@ public class CreateContainer extends BaseCommand
public Integer call() throws Exception
{
URI doc = URIs.childURI(parent, slug != null ? slug : Slugs.defaultSlug());
- put(getClient(), doc, Documents.container(doc, title, description, block, mode, primaryTopic));
+ put(getClient(), doc, Documents.container(doc, title, description, childrenView, primaryTopic));
print(doc);
return 0;
diff --git a/rdf/src/main/java/com/atomgraph/linkeddatahub/rdf/Documents.java b/rdf/src/main/java/com/atomgraph/linkeddatahub/rdf/Documents.java
index 5912db4f8..6b1b0a582 100644
--- a/rdf/src/main/java/com/atomgraph/linkeddatahub/rdf/Documents.java
+++ b/rdf/src/main/java/com/atomgraph/linkeddatahub/rdf/Documents.java
@@ -16,10 +16,8 @@
package com.atomgraph.linkeddatahub.rdf;
-import com.atomgraph.linkeddatahub.rdf.vocabulary.AC;
import com.atomgraph.linkeddatahub.rdf.vocabulary.DH;
import com.atomgraph.linkeddatahub.rdf.vocabulary.LDH;
-import com.atomgraph.linkeddatahub.rdf.vocabulary.SPIN;
import java.net.URI;
import org.apache.jena.rdf.model.Model;
import org.apache.jena.rdf.model.ModelFactory;
@@ -39,18 +37,18 @@ public final class Documents
private Documents() { }
/**
- * Builds the container document model with its first content block: the given block URI,
- * a children view with an explicit mode, or the default children view.
+ * Builds the container document model, by default with the children view as its first content
+ * block, as the dh:Container constructor makes it. Any other content is appended
+ * to the document afterwards, as to any other document.
*
* @param doc document URI
* @param title document title
* @param description document description (optional)
- * @param block content block URI (optional)
- * @param mode children view mode URI (optional, ignored when block is given)
+ * @param childrenView whether the first content block shows the container's children
* @param primaryTopic URI of the document's primary topic, relative or absolute (optional)
* @return document model
*/
- public static Model container(URI doc, String title, String description, URI block, URI mode, String primaryTopic)
+ public static Model container(URI doc, String title, String description, boolean childrenView, String primaryTopic)
{
Model model = ModelFactory.createDefaultModel();
@@ -58,14 +56,7 @@ public static Model container(URI doc, String title, String description, URI blo
addProperty(RDF.type, DH.Container).
addProperty(DCTerms.title, title);
- if (block != null) container.addProperty(RDF.li(1), model.createResource(block.toString()));
- else if (mode != null) container.addProperty(RDF.li(1), model.createResource().
- addProperty(RDF.type, LDH.Object).
- addProperty(RDF.value, model.createResource().
- addProperty(RDF.type, LDH.View).
- addProperty(SPIN.query, LDH.SelectChildren).
- addProperty(AC.mode, model.createResource(mode.toString()))));
- else container.addProperty(RDF.li(1), model.createResource().
+ if (childrenView) container.addProperty(RDF.li(1), model.createResource().
addProperty(RDF.type, LDH.Object).
addProperty(RDF.value, LDH.ChildrenView));
diff --git a/rdf/src/test/java/com/atomgraph/linkeddatahub/rdf/ModelBuildersTest.java b/rdf/src/test/java/com/atomgraph/linkeddatahub/rdf/ModelBuildersTest.java
index 9ff9eeb0d..83c4f490d 100644
--- a/rdf/src/test/java/com/atomgraph/linkeddatahub/rdf/ModelBuildersTest.java
+++ b/rdf/src/test/java/com/atomgraph/linkeddatahub/rdf/ModelBuildersTest.java
@@ -117,29 +117,17 @@ public void createContainerDefaultChildrenView()
dct:title "Some" ;
rdf:_1 [ a ldh:Object ; rdf:value ldh:ChildrenView ] .
"""),
- Documents.container(TARGET, "Some", null, null, null, null));
+ Documents.container(TARGET, "Some", null, true, null));
}
@Test
- public void createContainerWithMode()
+ public void createContainerWithoutChildrenView()
{
assertIsomorphic(parse("""
<> a dh:Container ;
- dct:title "Some" ;
- rdf:_1 [ a ldh:Object ; rdf:value [ a ldh:View ; spin:query ldh:SelectChildren ; ac:mode ] ] .
- """),
- Documents.container(TARGET, "Some", null, null, URI.create("https://w3id.org/atomgraph/client#GridMode"), null));
- }
-
- @Test
- public void createContainerWithBlock()
- {
- assertIsomorphic(parse("""
- <> a dh:Container ;
- dct:title "Some" ;
- rdf:_1 .
+ dct:title "Some" .
"""),
- Documents.container(TARGET, "Some", null, URI.create("https://localhost:4443/some/#block"), null, null));
+ Documents.container(TARGET, "Some", null, false, null));
}
@Test
@@ -153,7 +141,7 @@ public void createContainerWithPrimaryTopic()
rdf:_1 [ a ldh:Object ; rdf:value ldh:ChildrenView ] ;
foaf:primaryTopic <#this> .
"""),
- Documents.container(TARGET, "Some", null, null, null, "#this"));
+ Documents.container(TARGET, "Some", null, true, "#this"));
}
@Test