[dna-issues] [JBoss JIRA] Commented: (DNA-215) Graph API for working with repository content
Randall Hauch (JIRA)
jira-events at lists.jboss.org
Thu Sep 18 10:58:21 EDT 2008
[ https://jira.jboss.org/jira/browse/DNA-215?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12430231#action_12430231 ]
Randall Hauch commented on DNA-215:
-----------------------------------
Here is my latest thought on what the DSL might look like when used. (This is in the GraphTest unit test in the patch.) Comments are welcome:
// Get all (or some) of the children of a node ...
Children children1 = graph.get().children().at(path);
Children children2 = graph.get().children().of(path);
Children children3 = graph.get().children().of(path).matching(nameMatcher);
Children children4 = graph.get().children().matching(nameMatcher).of(path);
Children children5 = graph.get().children().having(propertyMatcher).of(path);
// Get the values of a single property by iterating ...
for (Object value : graph.get().property(name).at(path)) {
}
for (Object value : graph.get().property(name).on(path)) {
}
for (Object value : graph.get().property(name).of(path)) {
}
// Get the properties on a node by iterating ...
for (Property property : graph.get().properties().at(path)) {
}
for (Property property : graph.get().properties().at(path).matching(nameMatcher)) {
}
for (Property property : graph.get().properties().at(path).matching(nameMatcher)) {
}
// Get a node (both properties and children) ...
Node node1 = graph.get().node().at(path);
Node node2 = graph.get().node().with(uuid);
Node node3 = graph.get().node().having(uuid);
Node node4 = graph.get().node().at(uuid);
Node node5 = graph.get().node(path);
Node node6 = graph.get().node(uuid);
// Work with the properties and children of a previously obtained node...
Children children6 = node1.getChildren();
Children children7 = node1.getChildren().having(propertyMatcher);
Children children8 = node1.getChildren().matching(nameMatcher);
Property prop7 = node1.getProperty(name);
MultipleProperties props4 = node1.getProperties();
MultipleProperties props5 = node1.getProperties().having(propertyMatcher);
MultipleProperties props6 = node1.getProperties().matching(nameMatcher);
// Get a subgraph (nodes and properties)
Subgraph subgraph1 = graph.get().subgraph("/a/b");
Subgraph subgraph2 = graph.get().subgraph("/a/b").ofDepth(3);
Subgraph subgraph3 = graph.get().subgraph().at("/a/b").ofDepth(3);
Subgraph subgraph4 = graph.get().subgraph().at(uuid).ofDepth(3);
// Get nodes from within a subgraph ...
Node node10 = subgraph1.getRoot();
Node node11 = subgraph1.getNode(relativePath);
Node node12 = subgraph1.getNode(uuid);
// We can add support for visitors, too
// graph.get().subgraph(path).visit(myVisitor);
// Then there are operations on a graph that result in changes to the graph. These consist of
// copy, delete, move, create, and set. When using these, the graph records the commands but
// delays executing (or committing) them against the source until the "commit()" method is called.
//
// Changes to the graph can be interspersed with "get()" commands. When this happens, it is
// up to the graph implementation to define the behavior when the result of a get command
// is requested (e.g., the get command is to be executed) while there are uncommitted changes.
// Copy a portion of the content in the graph ...
graph.copy().node("/a/b/").into("/x/y");
graph.copy().node("/a/b/").into("/x/y").and().get().node("/m/n");
graph.copyNode("/a/b/").into("/x/y");
graph.copy().node().at("/a/b").into("/x/y");
graph.copy().node().with(uuid).into("/x/y");
graph.copy().subgraph("/a/b").into("/x/y");
graph.copy().subgraph().at(uuid).into("/x/y");
graph.copySubgraph("/a/b/").into("/x/y");
graph.copy().children().of(uuid).into("/x/y");
graph.copy().children().matching(nameMatcher).on(uuid).into("/x/y");
graph.copy().children().of(uuid).matching(nameMatcher).into("/x/y");
graph.copy().children().of("/a/b").into("/x/y");
graph.copy().properties().of("/a/b").into("/x/y");
graph.move().node("/a/b/").into("/x/y");
graph.move().node("/a/b/").into("/x/y").and().get().node("/m/n");
graph.move().node().at("/a/b").into("/x/y");
graph.move().node().with(uuid).into("/x/y");
graph.move().properties().of("/a/b").into("/x/y");
graph.move().properties().of("/a/b").matching(nameMatcher).into("/x/y");
graph.move().children().of("/a/b").into("/x/y");
graph.move().children().of(uuid).into("/x/y");
graph.move().children().with(nameMatcher).on(uuid).into("/x/y");
graph.move().children().having(propertyMatcher).on(uuid).into("/x/y");
graph.move().children().matching(nameMatcher).on(uuid).into("/x/y");
graph.move().children().of(uuid).matching(nameMatcher).into("/x/y");
graph.move().properties().matching(nameMatcher).on(uuid).into("/x/y");
graph.move().properties().of(uuid).matching(nameMatcher).into("/x/y");
graph.move().properties().with(nameMatcher).on(uuid).into("/x/y");
graph.move().properties().having(propertyMatcher).on(uuid).into("/x/y");
graph.move().properties().of(uuid).matching(nameMatcher).into("/x/y");
graph.move("/a/b/").into("/x/y").and().getNode("/m/n");
graph.delete().nodes().under(path);
graph.delete().nodes().under(path).matching(nameMatcher);
graph.delete().nodes().under(path).having(propertyMatcher);
graph.delete().node("/a/b");
graph.delete().child(name).on(uuid);
graph.delete().child(name, 1).on(uuid);
graph.delete().child(pathSegment).on(uuid);
graph.delete().children().matching(nameMatcher).on(uuid);
graph.delete().children().matching(nameMatcher).on("/a/b");
graph.delete().children().having(propertyMatcher).on("/a/b");
graph.delete().children().of(uuid).matching(nameMatcher);
graph.delete().children().of("/a/b").matching(nameMatcher);
graph.delete().children().of("/a/b").having(propertyMatcher);
graph.delete().property("p1").on("/a/b");
graph.delete().property("p1").on(uuid);
graph.delete().property("p1").and().property("p2").on(uuid);
graph.delete().properties("p1", "p2").on(uuid);
graph.delete().properties().matching(nameMatcher);
graph.delete().property().matching(nameMatcher);
graph.delete().property("p1").and().children().matching(nameMatcher).on(uuid);
graph.delete().node(path).and().delete().node(path);
graph.delete().node(path).and(path);
graph.delete().nodes(path, path);
graph.create().node().at(path).with().property("p1", 1, 2, 3);
graph.create().node().at(path).with().property("p1", 1, 2, 3).and("p2", 1);
graph.create().node(path).with().property("p1", 1, 2, 3).and("p2", 1);
graph.create().node(path).with(uuid).and("p1", 1, 2, 3).and("p2", 1);
graph.create().node(path).with("p1", 1, 2, 3).and("p2", 1);
graph.create().child(name).under(path).with().property("p1", 1, 2, 3).and("p2", 1);
graph.create().child(name, 3).under(path).with().property("p1", 1, 2, 3).and("p2", 1);
graph.create().orUpdate().node().at(path).with().property("p1", 1, 2, 3).and("p2", 1);
graph.create().node("/a/b").with().property("p1", 1, 2, 3).and("p2", 2);
graph.create("/a/b").with().property("p1", 1, 2, 3).and("p2", 2);
graph.create("/a/b").with("p1", 1, 2, 3).and("p2", 2);
graph.create("/a/b").with("p1", 1, 2, 3).and("p2", 2).and().create("/a/b/c").with(uuid).and("p3", "p3value");
graph.create("/a/b").with(uuid).and("p1", 1, 2, 3).and("p2", 2);
graph.create("/a/b").with(uuid).and("p1", 1, 2).and("p2", 2).and().createChild("c").under(path).with().property("p3", 10);
graph.create("/a/b").with(uuid).and("p1", 1, 2, 3).and("p2", 2).and().create("/a/b/c").with().property("p3", 10);
graph.createChild("c").under("/a/b").with("p1", 1, 2, 3).and("p2", 2);
graph.createChild("c/d").under("/a/b").with("p1", 1, 2, 3).and("p2", 2);
graph.set().property("p1").on(path).to(1, 2).and().set().property("p2").on("/c/d/");
graph.set().property("p1", 1, 2).on("/a/b").and().set().property("p2").on("/c/d/");
graph.set().property("p1", 1, 2).and("p2", "value").and("p3", "x").on("/a/b").and().set().property("p2").on("/c/d/");
graph.set().property("p1", 1, 2).and("p2").to("value").on("/a/b").and().set().property("p2").on("/c/d/");
graph.set().property("p1").to(1, 2).and("p2").to("value").on("/a/b").and().set().property("p2").on("/c/d/");
graph.set("p1").to(1, 2).on("/a/b").and().set().property("p2").on("/c/d/");
graph.set("p1", 1, 2).on("/a/b").and().set().property("p2").on("/c/d/");
// Changes made via a graph are committed (or executed) using the "commit" method.
graph.commit();
> Graph API for working with repository content
> ---------------------------------------------
>
> Key: DNA-215
> URL: https://jira.jboss.org/jira/browse/DNA-215
> Project: DNA
> Issue Type: Feature Request
> Components: API, Connectors
> Affects Versions: 0.2
> Reporter: Randall Hauch
> Assignee: Randall Hauch
> Fix For: 0.3
>
> Attachments: dna-spi.patch
>
>
> We need to make it easier to work with the content provided by the connectors. The command framework is okay, but it is entirely oriented towards the connector, not the user of the connector. Instead, we need an API that hides the command system (as much as possible) and that provides an easy way to work with the content.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the dna-issues
mailing list