Package org.qubitpi.wilhelm
Class Node
java.lang.Object
org.qubitpi.wilhelm.Node
A JSON-serializable object representation of a knowledge graph node in wilhelm-ws.
A Node
has 3 public attributes:
- A unique string identifier within a knowledge graph
- A string used as the caption for rendering the node
- A map containing all other information encapsulated
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The database node attribute name whose value is used for displaying the node caption on UI. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns an immutable view of the attributes of this Node.@NotNull String
getId()
@NotNull String
getLabel()
int
hashCode()
toString()
Returns a string representation of this Node.static Node
valueOf
(org.neo4j.driver.types.Node node) Converts a Neo4J API node to a wilhelm-wsNode
.
-
Field Details
-
LABEL_ATTRIBUTE
The database node attribute name whose value is used for displaying the node caption on UI.For example, for Neo4J database, this would correspond to a node property.
- See Also:
-
-
Method Details
-
valueOf
Converts a Neo4J API node to a wilhelm-wsNode
.The Neo4J node must contain a property called "name", otherwise an unchecked exception is thrown. The
Entity.elementId()
would be theID of this node
; the "name" property would be thelabel of this node.
; the rest of the properties would be theattributes
of this node- Parameters:
node
- A Neo4J Java driver API node- Returns:
- a new instance of converted
Node
- Throws:
NullPointerException
- ifnode
isnull
IllegalStateException
- ifnode
is missing a "name" property
-
getId
-
getLabel
-
getAttributes
Returns an immutable view of the attributes of this Node.- Returns:
- an unmodifiable map
-
equals
-
hashCode
public int hashCode() -
toString
Returns a string representation of this Node.The content of the string equals to
the label
of this Node.
-