Пример #1
0
        public static HttpStatusCode CreateRelationshipIndex(string dbUrl, string indexName, string jsonConfig, out string response)
        {
            var jo = new JObject {
                { "name", indexName }, { "config", jsonConfig }
            };

            return(HttpRest.Post(Connection.GetServiceRoot(dbUrl).RelationshipIndex, jo.ToString(Formatting.None, new IsoDateTimeConverter()), out response));
        }
Пример #2
0
        public static HttpStatusCode CreateRelationship(string dbUrl, long startNodeId, long endNodeId, string name, string jsonProperties, out string response)
        {
            var jo = new JObject
            {
                { "to", string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", endNodeId) },
                { "data", JToken.Parse(string.IsNullOrWhiteSpace(jsonProperties) ? "{}" : jsonProperties) },
                { "type", name }
            };

            return(HttpRest.Post(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", startNodeId.ToString(), "/relationships"), jo.ToString(Formatting.None, new IsoDateTimeConverter()), out response));
        }
Пример #3
0
        public static HttpStatusCode CreateUniqueNode(string dbUrl, string jsonProperties, string indexName, string key, object value, IndexUniqueness uniqueness, out string response)
        {
            var jo = new JObject
            {
                { "key", key },
                { "value", JToken.FromObject(value) },
                { "properties", JToken.Parse(string.IsNullOrWhiteSpace(jsonProperties) ? "{}" : jsonProperties) }
            };

            return(HttpRest.Post(string.Concat(Connection.GetServiceRoot(dbUrl).NodeIndex, "/", indexName, "?uniqueness=", uniqueness), jo.ToString(Formatting.None, new IsoDateTimeConverter()), out response));
        }
Пример #4
0
        public static HttpStatusCode AddNodeToIndex(string dbUrl, string nodeSelf, string indexName, string key, object value, out string response)
        {
            var jo = new JObject
            {
                { "key", key },
                { "value", JToken.FromObject(value) },
                { "uri", nodeSelf }
            };

            return(HttpRest.Post(string.Concat(Connection.GetServiceRoot(dbUrl).NodeIndex, "/", indexName), jo.ToString(Formatting.None, new IsoDateTimeConverter()), out response));
        }
Пример #5
0
        public static HttpStatusCode CreateUniqueRelationship(string dbUrl, long startNodeId, long endNodeId, string name, string jsonProperties, string indexName, string key, object value, IndexUniqueness uniqueness, out string response)
        {
            var jo = new JObject
            {
                { "key", key },
                { "value", JToken.FromObject(value) },
                { "start", string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", startNodeId) },
                { "end", string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", endNodeId) },
                { "properties", JToken.Parse(string.IsNullOrWhiteSpace(jsonProperties) ? "{}" : jsonProperties) },
                { "type", name }
            };

            return(HttpRest.Post(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName, "?uniqueness=", uniqueness), jo.ToString(), out response));
        }
Пример #6
0
 public static HttpStatusCode CreateNode(string dbUrl, string jsonProperties, out string response)
 {
     return(HttpRest.Post(Connection.GetServiceRoot(dbUrl).Node, string.IsNullOrWhiteSpace(jsonProperties) ? null : jsonProperties, out response));
 }