Interface GraphNode

  • All Superinterfaces:
    java.util.Map<java.lang.String,​java.lang.Object>

    @ProviderType
    public interface GraphNode
    extends java.util.Map<java.lang.String,​java.lang.Object>
    The GraphNode represents a user in the social graph.
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface java.util.Map

        java.util.Map.Entry<K extends java.lang.Object,​V extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Abstract Methods Deprecated Methods 
      Modifier and Type Method Description
      Relationship createRelationshipTo​(GraphNode other, java.lang.String type)
      Creates a relationship to the given node.
      void delete()
      Deletes this graph node and all outgoing relationships.
      <T> T get​(java.lang.String name, java.lang.Class<T> type)
      Get a named property and convert it into the given type.
      <T> T get​(java.lang.String name, T defaultValue)
      Get a named property and convert it into the given type.
      java.lang.String getId()
      Returns the id of this node.
      Relationship getRelationship​(Direction dir, GraphNode node, java.lang.String type)
      Returns the relationship between this and the give node in the specified direction and type.
      java.lang.Iterable<Relationship> getRelationships​(Direction dir, java.lang.String... types)
      Returns the relationships attached to this node of the specific type and direction.
      Resource getResource()
      Returns the resource of object addressed by id or null if it does not exist.
      boolean isVirtual()
      Deprecated.
      virtual nodes are no longer supported.
      • Methods inherited from interface java.util.Map

        clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
    • Method Detail

      • getId

        java.lang.String getId()
        Returns the id of this node.
        Returns:
        the id.
      • getResource

        Resource getResource()
        Returns the resource of object addressed by id or null if it does not exist.
        Returns:
        the resource.
      • isVirtual

        @Deprecated
        boolean isVirtual()
        Deprecated.
        virtual nodes are no longer supported.
        Specifies tha this node is virtual and is not (and will never be) backed by a persistence object.
        Returns:
        true if this node is virtual.
      • createRelationshipTo

        Relationship createRelationshipTo​(GraphNode other,
                                          java.lang.String type)
        Creates a relationship to the given node.
        Parameters:
        other - the other node
        type - the type of the relationship
        Returns:
        the relationship
        Throws:
        java.lang.IllegalArgumentException - if the relationship already exists
        SocialGraphException - if an error during this operation occurs.
      • delete

        void delete()
        Deletes this graph node and all outgoing relationships. TODO: specify what should happen to incoming relationships
      • getRelationships

        java.lang.Iterable<Relationship> getRelationships​(Direction dir,
                                                          java.lang.String... types)
        Returns the relationships attached to this node of the specific type and direction.
        Parameters:
        dir - the direction
        types - the types of relationships to return.
        Returns:
        a collection of relationships
      • getRelationship

        Relationship getRelationship​(Direction dir,
                                     GraphNode node,
                                     java.lang.String type)
        Returns the relationship between this and the give node in the specified direction and type. Example: if A --[follows]--> B, then B.getRelationShip(Direction.OUTGOING, A, "follows") and, A.getRelationShip(Direction.INCOMING, B, "follows") Both return the same relationship defined above.
        Parameters:
        dir - direction of the relationship to return
        node - the other node
        type - the type of relationship
        Returns:
        the desired relationship or null
      • get

        <T> T get​(java.lang.String name,
                  java.lang.Class<T> type)
        Get a named property and convert it into the given type.
        Type Parameters:
        T - the type
        Parameters:
        name - The name of the property
        type - The class of the type
        Returns:
        Return named value converted to type T or null if non existing or can't be converted.
      • get

        <T> T get​(java.lang.String name,
                  T defaultValue)
        Get a named property and convert it into the given type.
        Type Parameters:
        T - the type
        Parameters:
        name - The name of the property
        defaultValue - The default value to use if the named property does not exist or cannot be converted to the requested type. The default value is also used to define the type to convert the value to. If this is null any existing property is not converted.
        Returns:
        Return named value converted to type T or the default value if non existing or can't be converted.