Package org.qubitpi.wilhelm
Class Link
java.lang.Object
org.qubitpi.wilhelm.Link
A JSON-serializable object representation of a directed link of knowledge graph in wilhelm-ws.
A Link
has 4 public attributes:
- A string used as the caption for rendering the link
- The
unique identifier of node
originating this link - The
unique identifier of node
pointed to by this link - 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 relationship caption on UI. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Returns an immutable view of the attributes of this Link.@NotNull String
getLabel()
@NotNull String
@NotNull String
int
hashCode()
toString()
static Link
valueOf
(org.neo4j.driver.types.Relationship relationship) Converts a Neo4J API relationship to a wilhelm-wsLink
.
-
Field Details
-
LABEL_ATTRIBUTE
The database node attribute name whose value is used for displaying the relationship caption on UI.For example, for Neo4J database, this would correspond to a relationship property.
- See Also:
-
-
Method Details
-
valueOf
Converts a Neo4J API relationship to a wilhelm-wsLink
.The Neo4J relationship must contain a property called "name", otherwise an unchecked exception is thrown. The
Relationship.startNodeElementId()
would be thesource node ID
; theRelationship.endNodeElementId()
would be thetarget node ID
the "name" property would be thelabel of this node.
; the rest of the properties would be theattributes
of this node- Parameters:
relationship
- A Neo4J Java driver API relationship- Returns:
- a new instance of converted
Link
- Throws:
NullPointerException
- ifrelationship
isnull
IllegalStateException
- ifrelationship
is missing a "name" property
-
getLabel
-
getSourceNodeId
-
getTargetNodeId
-
getAttributes
Returns an immutable view of the attributes of this Link.- Returns:
- an unmodifiable map
-
equals
-
hashCode
public int hashCode() -
toString
-