Class Link

java.lang.Object
org.qubitpi.wilhelm.Link

@Immutable @ThreadSafe public class Link extends Object
A JSON-serializable object representation of a directed link of knowledge graph in wilhelm-ws.

A Link has 4 public attributes:

  1. A string used as the caption for rendering the link
  2. The unique identifier of node originating this link
  3. The unique identifier of node pointed to by this link
  4. A map containing all other information encapsulated
  • Field Details

    • LABEL_ATTRIBUTE

      public static final String 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

      public static Link valueOf(org.neo4j.driver.types.Relationship relationship)
      Converts a Neo4J API relationship to a wilhelm-ws Link.

      The Neo4J relationship must contain a property called "name", otherwise an unchecked exception is thrown. The Relationship.startNodeElementId() would be the source node ID; the Relationship.endNodeElementId() would be the target node ID the "name" property would be the label of this node.; the rest of the properties would be the attributes of this node

      Parameters:
      relationship - A Neo4J Java driver API relationship
      Returns:
      a new instance of converted Link
      Throws:
      NullPointerException - if relationship is null
      IllegalStateException - if relationship is missing a "name" property
    • getLabel

      @NotNull public @NotNull String getLabel()
    • getSourceNodeId

      @NotNull public @NotNull String getSourceNodeId()
    • getTargetNodeId

      @NotNull public @NotNull String getTargetNodeId()
    • getAttributes

      @NotNull public @NotNull Map<String,Object> getAttributes()
      Returns an immutable view of the attributes of this Link.
      Returns:
      an unmodifiable map
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object