Ejemplo n.º 1
0
        public static Node Initilize(Properties properties, string selfUri, INodeStore nodeStore = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            return(nodeStore.Initilize(selfUri, properties));
        }
Ejemplo n.º 2
0
        public static List <Path> ParseJson(string jsonPaths, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            if (String.IsNullOrEmpty(jsonPaths))
            {
                return(null);
            }

            var jaPaths = JArray.Parse(jsonPaths);

            return(ParseJson(jaPaths));
        }
Ejemplo n.º 3
0
        public static List <Path> ParseJson(JArray jsonPaths, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            if (jsonPaths == null)
            {
                return(null);
            }

            var jaPaths = jsonPaths;

            return((from JObject joPath in jaPaths select new Path(joPath, nodeGraphStore, relationshipGraphStore)).ToList());
        }
Ejemplo n.º 4
0
        public static Node Initilize(long id, Properties properties, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.Initilize(connection, id, properties));
        }
Ejemplo n.º 5
0
        public ZNodeController(ISessionStore sessions, INodeStore nodes)
        {
            if (sessions == null)
            {
                throw new ArgumentNullException(nameof(sessions));
            }
            if (nodes == null)
            {
                throw new ArgumentNullException(nameof(nodes));
            }

            _sessions = sessions;
            _nodes    = nodes;
        }
Ejemplo n.º 6
0
        public static Node GetNode(long nodeId, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.GetNode(connection, nodeId));
        }
Ejemplo n.º 7
0
        public static void SetProperty <T>(Node node, string key, T value, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            nodeStore.SetProperty(node, key, value);
        }
Ejemplo n.º 8
0
        public static Node Initilize(Properties properties = null, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (properties == null)
            {
                properties = new Properties();
            }

            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.Initilize(connection.DbUrl, properties));
        }
Ejemplo n.º 9
0
        public static Node CreateNode(Properties properties, INodeStore nodeStore, ConnectionElement connection = null)
        {
            if (properties == null)
            {
                properties = new Properties();
            }

            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.CreateNode(connection, properties));
        }
Ejemplo n.º 10
0
 public static Node GetRootNode(INodeStore nodeStore)
 {
     return(GetRootNode(nodeStore, DefaultConnection));
 }
Ejemplo n.º 11
0
 public static Node GetRootNode(INodeStore nodeStore, ConnectionElement connection)
 {
     return(nodeStore.GetRootNode(connection));
 }
Ejemplo n.º 12
0
 public static IEnumerable <Node> GetNode(Enum indexName, Enum key, object value, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(GetNode(indexName.ToString(), key.ToString(), value, nodeStore, connection));
 }
        public LocalNodeServerClient(INodeStore nodeStore)
        {
            Throw.IfNull(nodeStore, nameof(nodeStore));

            this.nodeStore = nodeStore;
        }
Ejemplo n.º 14
0
 public static List<Path> ParseJson(JArray jsonPaths, INodeStore nodeGraphStore)
 {
     return ParseJson(jsonPaths, nodeGraphStore, new RestRelationshipStore());
 }
Ejemplo n.º 15
0
        private Path(JObject path, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            JToken startNode;
            if (!path.TryGetValue("start", out startNode))
            {
                throw new Exception("Invalid path json");
            }

            switch (startNode.Type)
            {
                case JTokenType.String:
                    StartNode = nodeGraphStore.Initilize(startNode.Value<string>(), null);
                    break;

                //case JTokenType.Object:
                //    StartNode = nodeGraphStore.CreateNodeFromJson((JObject)startNode);
                //    break;

                default:
                    throw new Exception("Invalid path json");
            }

            JToken endNode;
            if (!path.TryGetValue("end", out endNode))
            {
                throw new Exception("Invalid path json");
            }

            switch (endNode.Type)
            {
                case JTokenType.String:
                    EndNode = nodeGraphStore.Initilize(endNode.Value<string>(), null);
                    break;

                //case JTokenType.Object:
                //    EndNode = nodeGraphStore.CreateNodeFromJson((JObject)endNode);
                //    break;

                default:
                    throw new Exception("Invalid path json");
            }

            Nodes = new List<Node>();
            JToken nodes;
            if (!path.TryGetValue("nodes", out nodes) || nodes.Type != JTokenType.Array)
            {
                throw new Exception("Invalid path json");
            }

            foreach (JToken node in nodes)
            {
                switch (node.Type)
                {
                    case JTokenType.String:
                        Nodes.Add(nodeGraphStore.Initilize(node.Value<string>(), null));
                        break;

                    //case JTokenType.Object:
                    //    Nodes.Add(nodeGraphStore.CreateNodeFromJson((JObject)node));
                    //    break;

                    default:
                        throw new Exception("Invalid path json");
                }
            }

            Relationships = new List<Relationship>();
            JToken relationships;
            if (!path.TryGetValue("relationships", out relationships) || relationships.Type != JTokenType.Array)
            {
                throw new Exception("Invalid path json");
            }

            foreach (JToken relationship in relationships)
            {
                switch (relationship.Type)
                {
                    case JTokenType.String:
                        Relationships.Add(relationshipGraphStore.Initilize(relationship.Value<string>(), null));
                        break;

                    //case JTokenType.Object:
                    //    Relationships.Add(relationshipGraphStore.CreateRelationshipFromJson((JObject)relationship));
                    //    break;

                    default:
                        throw new Exception("Invalid path json");
                }
            }

            OriginalPathJson = path.ToString(Formatting.None);
        }
Ejemplo n.º 16
0
        private Path(JObject path, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            JToken startNode;

            if (!path.TryGetValue("start", out startNode))
            {
                throw new Exception("Invalid path json");
            }

            switch (startNode.Type)
            {
            case JTokenType.String:
                StartNode = nodeGraphStore.Initilize(startNode.Value <string>(), null);
                break;

            //case JTokenType.Object:
            //    StartNode = nodeGraphStore.CreateNodeFromJson((JObject)startNode);
            //    break;

            default:
                throw new Exception("Invalid path json");
            }

            JToken endNode;

            if (!path.TryGetValue("end", out endNode))
            {
                throw new Exception("Invalid path json");
            }

            switch (endNode.Type)
            {
            case JTokenType.String:
                EndNode = nodeGraphStore.Initilize(endNode.Value <string>(), null);
                break;

            //case JTokenType.Object:
            //    EndNode = nodeGraphStore.CreateNodeFromJson((JObject)endNode);
            //    break;

            default:
                throw new Exception("Invalid path json");
            }

            Nodes = new List <Node>();
            JToken nodes;

            if (!path.TryGetValue("nodes", out nodes) || nodes.Type != JTokenType.Array)
            {
                throw new Exception("Invalid path json");
            }

            foreach (JToken node in nodes)
            {
                switch (node.Type)
                {
                case JTokenType.String:
                    Nodes.Add(nodeGraphStore.Initilize(node.Value <string>(), null));
                    break;

                //case JTokenType.Object:
                //    Nodes.Add(nodeGraphStore.CreateNodeFromJson((JObject)node));
                //    break;

                default:
                    throw new Exception("Invalid path json");
                }
            }

            Relationships = new List <Relationship>();
            JToken relationships;

            if (!path.TryGetValue("relationships", out relationships) || relationships.Type != JTokenType.Array)
            {
                throw new Exception("Invalid path json");
            }

            foreach (JToken relationship in relationships)
            {
                switch (relationship.Type)
                {
                case JTokenType.String:
                    Relationships.Add(relationshipGraphStore.Initilize(relationship.Value <string>(), null));
                    break;

                //case JTokenType.Object:
                //    Relationships.Add(relationshipGraphStore.CreateRelationshipFromJson((JObject)relationship));
                //    break;

                default:
                    throw new Exception("Invalid path json");
                }
            }

            OriginalPathJson = path.ToString(Formatting.None);
        }
Ejemplo n.º 17
0
        public static bool RemoveFromIndex(Node node, string indexName, string key = null, object value = null, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(key == null?
                   nodeStore.RemoveFromIndex(connection, node, indexName)
                       : value == null?
                       nodeStore.RemoveFromIndex(connection, node, indexName, key)
                           : nodeStore.RemoveFromIndex(connection, node, indexName, key, value));
        }
Ejemplo n.º 18
0
 public static bool RemoveFromIndex(Node node, Enum indexName, Enum key = null, object value = null, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(RemoveFromIndex(node, indexName.ToString(), key == null ? null : key.ToString(), value, nodeStore, connection));
 }
Ejemplo n.º 19
0
        public static Node AddToIndex(Node node, string indexName, string key, object value, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.AddToIndex(connection, node, indexName, key, value));
        }
Ejemplo n.º 20
0
 public static Node AddToIndex(Node node, Enum indexName, Enum key, object value, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(AddToIndex(node, indexName.ToString(), key.ToString(), value, nodeStore, connection));
 }
Ejemplo n.º 21
0
        public static IEnumerable <Node> GetNode(string indexName, string searchQuery, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.GetNode(connection, indexName, searchQuery));
        }
Ejemplo n.º 22
0
 public static IEnumerable <Node> GetNode(Enum indexName, string searchQuery, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(GetNode(indexName.ToString(), searchQuery, nodeStore, connection));
 }
Ejemplo n.º 23
0
        public static IEnumerable <Node> GetNode(string indexName, string key, object value, INodeStore nodeStore = null, ConnectionElement connection = null)
        {
            if (nodeStore == null)
            {
                nodeStore = new RestNodeStore();
            }

            if (connection == null)
            {
                connection = DefaultConnection;
            }

            return(nodeStore.GetNode(connection, indexName, key, value));
        }
Ejemplo n.º 24
0
 public static List <Path> ParseJson(JArray jsonPaths, INodeStore nodeGraphStore)
 {
     return(ParseJson(jsonPaths, nodeGraphStore, new RestRelationshipStore()));
 }
Ejemplo n.º 25
0
 public Node(Properties properties = null)
 {
     _properties     = properties;
     _nodeGraphStore = new RestNodeStore();
 }
Ejemplo n.º 26
0
 public static Node GetNode(EncryptId nodeId, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(GetNode((long)nodeId, nodeStore, connection));
 }
Ejemplo n.º 27
0
 public NodeManager(INodeStore store)
 {
     _store = store;
 }
Ejemplo n.º 28
0
 public static void SetProperty <T>(Node node, Enum key, T value, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     SetProperty(node, key.ToString(), value, nodeStore, connection);
 }
Ejemplo n.º 29
0
        public static List<Path> ParseJson(string jsonPaths, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            if (String.IsNullOrEmpty(jsonPaths))
            {
                return null;
            }

            var jaPaths = JArray.Parse(jsonPaths);
            return ParseJson(jaPaths);
        }
Ejemplo n.º 30
0
 public static Node CreateNode(INodeStore nodeStore, ConnectionElement connection = null)
 {
     return(CreateNode(null, nodeStore, connection));
 }
Ejemplo n.º 31
0
        public static List<Path> ParseJson(JArray jsonPaths, INodeStore nodeGraphStore, IRelationshipStore relationshipGraphStore)
        {
            if (jsonPaths == null)
            {
                return null;
            }

            var jaPaths = jsonPaths;

            return (from JObject joPath in jaPaths select new Path(joPath, nodeGraphStore, relationshipGraphStore)).ToList();
        }
Ejemplo n.º 32
0
 public static Node CreateUniqueNode(Enum indexName, Enum key, object value, IndexUniqueness uniqueness, Properties properties = null, INodeStore nodeStore = null, ConnectionElement connection = null)
 {
     return(CreateUniqueNode(indexName.ToString(), key.ToString(), value, uniqueness, properties, nodeStore, connection));
 }
Ejemplo n.º 33
0
 public LocalNodeServerClient(INodeStore nodeStore)
 {
     this.nodeStore = nodeStore ?? throw new ArgumentNullException();
 }
Ejemplo n.º 34
0
 public Node(INodeStore nodeStore, Properties properties = null)
 {
     _properties     = properties;
     _nodeGraphStore = nodeStore;
 }