MCPcopy Create free account
hub / github.com/SciGraph/SciGraph / Graph

Interface Graph

SciGraph-core/src/main/java/io/scigraph/neo4j/Graph.java:31–194  ·  view source on GitHub ↗

Abstract methods for dealing with an underlying graph. NOTE: the ID of nodes and relationships is assumed to be Long

Source from the content-addressed store, hash-verified

29 *
30 */
31public interface Graph {
32
33 /***
34 * Create a node
35 * <p>
36 * This method is idempotent.
37 *
38 * @param id the string ID of the node
39 * @return the internal ID of a the node
40 */
41 long createNode(String id);
42
43 /***
44 * Get a node
45 *
46 * @param id
47 * @return an {@link Optional} node ID with this ID
48 */
49 Optional<Long> getNode(String id);
50
51 /***
52 * Create a relationship
53 *
54 * @param start The ID of the start node
55 * @param end The ID of the end node
56 * @param type The type of relationship
57 * @return The ID of a newly created relationship or the ID of an existing relationship
58 */
59 long createRelationship(long start, long end, RelationshipType type);
60
61 /***
62 * Get a relationship
63 *
64 * @param start The ID of the start node
65 * @param end The ID of the end node
66 * @param type The type of relationship
67 * @return An optional relationship ID
68 */
69 Optional<Long> getRelationship(long start, long end, RelationshipType type);
70
71 /***
72 * Creates relationships pairwise.
73 *
74 * This assumes that the relationships type is undirected in your domain.
75 *
76 * @param nodeIds The IDs of the nodes
77 * @param type The type of relationship
78 * @return The IDs of the relationships involved
79 */
80 Collection<Long> createRelationshipsPairwise(Collection<Long> nodeIds, RelationshipType type);
81
82 /***
83 * Set a node property
84 *
85 * This will erase a previous value.
86 *
87 * @param node The node ID
88 * @param property The property key

Callers 118

testMultipleInsertsMethod · 0.95
setupMethod · 0.65
whenNodes_healtyMethod · 0.65
setupMethod · 0.65
getNodeIdFromIriMethod · 0.65

Implementers 2

GraphTransactionalImplSciGraph-core/src/main/java/io/scigrap
GraphBatchImplSciGraph-core/src/main/java/io/scigrap

Calls

no outgoing calls

Tested by

no test coverage detected