Пример #1
0
 public static HttpStatusCode GetPropertyOnRelationship(string dbUrl, long relationshipId, string propertyName, out string response)
 {
     return
         (HttpRest.Get(
              string.Concat(Connection.GetServiceRoot(dbUrl).Relationship, "/", relationshipId.ToString(), "/properties/", propertyName),
              out response));
 }
Пример #2
0
 public static HttpStatusCode SetPropertyOnRelationship(string dbUrl, long relationshipId, string propertyName, object value)
 {
     return
         (HttpRest.Put(
              string.Concat(Connection.GetServiceRoot(dbUrl).Relationship, "/", relationshipId.ToString(), "/properties/", propertyName),
              JToken.FromObject(value).ToString()));
 }
Пример #3
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));
        }
Пример #4
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));
        }
Пример #5
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));
        }
Пример #6
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));
        }
Пример #7
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));
        }
Пример #8
0
        public static HttpStatusCode GetRelationshipsOnNode(string dbUrl, long nodeId, RelationshipDirection direction, IEnumerable <string> relationships, out string response)
        {
            if (direction == null)
            {
                direction = RelationshipDirection.All;
            }

            if (relationships == null || !relationships.Any())
            {
                return
                    (HttpRest.Get(
                         string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/relationships/", direction.ToString()),
                         out response));
            }

            return
                (HttpRest.Get(
                     string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/relationships/", direction.ToString(), "/",
                                   string.Join("&", relationships)), out response));
        }
Пример #9
0
 public static HttpStatusCode SetPropertyOnNode(string dbUrl, long nodeId, string propertyName, object value)
 {
     return(HttpRest.Put(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/properties/", propertyName),
                         JToken.FromObject(value).ToString(Formatting.None, new IsoDateTimeConverter())));
 }
Пример #10
0
 public static HttpStatusCode GetPropertiesOnNode(string dbUrl, long nodeId, out string response)
 {
     return(HttpRest.Get(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/properties"), out response));
 }
Пример #11
0
 public static HttpStatusCode SetPropertiesOnNode(string dbUrl, long nodeId, string jsonProperties)
 {
     return(HttpRest.Put(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/properties"), jsonProperties));
 }
Пример #12
0
 public static HttpStatusCode DeleteRelationship(string dbUrl, long relationshipId)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).Relationship, "/", relationshipId.ToString())));
 }
Пример #13
0
 public static HttpStatusCode GetRelationship(string dbUrl, string indexName, string searchQuery, out string response)
 {
     return(HttpRest.Get(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName, "?query=", Uri.EscapeDataString(searchQuery)), out response));
 }
Пример #14
0
        public static HttpStatusCode GetRelationship(string dbUrl, string indexName, string key, object value, out string response)
        {
            var strValue = value is string?Uri.EscapeDataString(value.ToString()) : value.ToString();

            return(HttpRest.Get(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName, "/", key, "/", strValue), out response));
        }
Пример #15
0
 public static HttpStatusCode GetRelationship(string dbUrl, long id, out string response)
 {
     return(HttpRest.Get(string.Concat(Connection.GetServiceRoot(dbUrl).Relationship, "/", id), out response));
 }
Пример #16
0
 public static HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, string indexName)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName, "/", relationshipId)));
 }
Пример #17
0
 public static HttpStatusCode RemovePropertiesFromRelationship(string dbUrl, long relationshipId)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", relationshipId.ToString(), "/properties")));
 }
Пример #18
0
 public static HttpStatusCode RemovePropertyFromNode(string dbUrl, long nodeId, string propertyName)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString(), "/properties/", propertyName)));
 }
Пример #19
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));
 }
Пример #20
0
 public static HttpStatusCode ListRelationshipIndexes(string dbUrl, out string response)
 {
     return(HttpRest.Get(Connection.GetServiceRoot(dbUrl).RelationshipIndex, out response));
 }
Пример #21
0
 public static HttpStatusCode DeleteRelationshipIndex(string dbUrl, string indexName)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName)));
 }
Пример #22
0
 public static HttpStatusCode GetRoot(string dbUrl, out string response)
 {
     return(HttpRest.Get(dbUrl, out response));
 }
Пример #23
0
 public static HttpStatusCode DeleteNode(string dbUrl, long nodeId)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).Node, "/", nodeId.ToString())));
 }
Пример #24
0
 public static HttpStatusCode RemoveNodeFromIndex(string dbUrl, long nodeId, string indexName)
 {
     return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).NodeIndex, "/", indexName, "/", nodeId)));
 }
Пример #25
0
        public static HttpStatusCode RemoveRelationshipFromIndex(string dbUrl, long relationshipId, string indexName, string key, object value)
        {
            var strValue = value is string?Uri.EscapeDataString(value.ToString()) : value.ToString();

            return(HttpRest.Delete(string.Concat(Connection.GetServiceRoot(dbUrl).RelationshipIndex, "/", indexName, "/", key, "/", strValue, "/", relationshipId)));
        }
Пример #26
0
 public static HttpStatusCode SetPropertiesOnRelationship(string dbUrl, long relationshipId, string jsonProperties)
 {
     return(HttpRest.Put(string.Concat(Connection.GetServiceRoot(dbUrl).Relationship, "/", relationshipId.ToString(), "/properties"), jsonProperties));
 }