public class NFGraphSpec extends java.lang.Object implements java.lang.Iterable<NFNodeSpec>
NFGraphSpec defines the schema for a graph. It contains a mapping of node type
name to NFNodeSpecs.The example code below will create two node types "a" and "b". An "a" node can be connected to "b" nodes via the properties "a-to-one-b" and/or "a-to-many-b". A "b" node can be connected to "a" nodes via the property "b-to-many-a".
NFGraphSpec spec = new NFGraphSpec(
new NFNodeSpec(
"a",
new NFPropertySpec("a-to-one-b", "b", NFPropertySpec.SINGLE),
new NFPropertySpec("a-to-many-b", "b", NFPropertySpec.MULTIPLE | NFPropertySpec.COMPACT)
),
new NFNodeSpec(
"b",
new NFPropertySpec("b-to-many-a", "a", NFPropertySpec.MULTIPLE | NFPropertySpec.HASH)
)
);
NFNodeSpec,
NFPropertySpec| Constructor and Description |
|---|
NFGraphSpec()
Instantiate a graph specification with no
NFNodeSpecs. |
NFGraphSpec(NFNodeSpec... nodeTypes)
Instantiate a graph specification with the given
NFNodeSpec. |
| Modifier and Type | Method and Description |
|---|---|
void |
addNodeSpec(NFNodeSpec nodeSpec)
Add a node type to this graph specification.
|
NFNodeSpec |
getNodeSpec(java.lang.String nodeType) |
java.util.List<java.lang.String> |
getNodeTypes() |
java.util.Iterator<NFNodeSpec> |
iterator()
Returns an
Iterator over the NFNodeSpecs contained in this graph specification. |
int |
size() |
public NFGraphSpec()
NFNodeSpecs.public NFGraphSpec(NFNodeSpec... nodeTypes)
NFNodeSpec.public NFNodeSpec getNodeSpec(java.lang.String nodeType)
NFNodeSpec for the specified node type.public void addNodeSpec(NFNodeSpec nodeSpec)
public int size()
public java.util.List<java.lang.String> getNodeTypes()
List containing the names of each of the node types.public java.util.Iterator<NFNodeSpec> iterator()
Iterator over the NFNodeSpecs contained in this graph specification.iterator in interface java.lang.Iterable<NFNodeSpec>