Esempio n. 1
0
 private static void ProcessAAttributeDefinition(GQLPluginManager myPluginManager,
                                                 IGraphDB myGraphDB,
                                                 SecurityToken mySecurityToken,
                                                 Int64 myTransactionToken,
                                                 IVertexType vertexType,
                                                 AAttributeAssignOrUpdate aAttributeDefinition,
                                                 ref RequestInsertVertex result)
 {
     if (vertexType.HasAttribute(aAttributeDefinition.AttributeIDChain.ContentString))
     {
         ProcessStructuredProperty(myPluginManager,
                                   myGraphDB,
                                   mySecurityToken,
                                   myTransactionToken,
                                   vertexType,
                                   aAttributeDefinition,
                                   ref result);
     }
     else
     {
         ProcessUnstructuredAttribute(vertexType,
                                      aAttributeDefinition,
                                      ref result);
     }
 }
Esempio n. 2
0
        public override IVertex AddVertex(RequestInsertVertex myInsertDefinition, Int64 myTransaction, SecurityToken mySecurity)
        {
            IVertexType vertexType = GetType(myInsertDefinition.VertexTypeName, myTransaction, mySecurity);

            if (vertexType.IsAbstract)
            {
                throw new AbstractConstraintViolationException(myInsertDefinition.VertexTypeName);
            }

            ConvertUnknownProperties(myInsertDefinition, vertexType);
            ConvertDefaultValues(myInsertDefinition, vertexType);

            if (myInsertDefinition.OutgoingEdges != null)
            {
                CheckOutgoingEdges(myInsertDefinition.OutgoingEdges, vertexType);
            }


            if (myInsertDefinition.StructuredProperties != null)
            {
                CheckAddStructuredProperties(myInsertDefinition.StructuredProperties, vertexType);
            }

            CheckMandatoryConstraint(myInsertDefinition, vertexType);

            if (myInsertDefinition.BinaryProperties != null)
            {
                CheckAddBinaryProperties(myInsertDefinition, vertexType);
            }

            return(null);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates the request for the graphdb
        /// </summary>
        /// <returns>The created vertex</returns>
        private RequestInsertVertex CreateRequest(GQLPluginManager myPluginManager,
                                                  IGraphDB myGraphDB,
                                                  SecurityToken mySecurityToken,
                                                  Int64 myTransactionToken)
        {
            #region data

            var result = new RequestInsertVertex(_TypeName);

            var vertexType = myGraphDB.GetVertexType <IVertexType>(
                mySecurityToken,
                myTransactionToken,
                new RequestGetVertexType(_TypeName),
                (stats, vtype) => vtype);

            #endregion

            if (_AttributeAssignList != null)
            {
                foreach (var aAttributeDefinition in _AttributeAssignList)
                {
                    ProcessAAttributeDefinition(myPluginManager,
                                                myGraphDB,
                                                mySecurityToken,
                                                myTransactionToken,
                                                vertexType,
                                                aAttributeDefinition,
                                                ref result);
                }
            }

            return(result);
        }
Esempio n. 4
0
 private static void CheckAddBinaryProperties(RequestInsertVertex myInsertDefinition, IVertexType vertexType)
 {
     foreach (var prop in myInsertDefinition.BinaryProperties)
     {
         var propertyDef = vertexType.GetBinaryPropertyDefinition(prop.Key);
         if (propertyDef == null)
         {
             throw new AttributeDoesNotExistException(prop.Key, myInsertDefinition.VertexTypeName);
         }
     }
 }
Esempio n. 5
0
        public TResult Insert <TResult>(
            SecurityToken mySecurity,
            Int64 myTransactionToken,
            RequestInsertVertex myRequestInsert,
            Converter.InsertResultConverter <TResult> myOutputconverter)
        {
            var executedRequest = _requestManager.SynchronExecution(new PipelineableInsertRequest(myRequestInsert,
                                                                                                  mySecurity,
                                                                                                  myTransactionToken));

            return(((PipelineableInsertRequest)executedRequest).GenerateRequestResult(myOutputconverter));
        }
Esempio n. 6
0
        internal ServiceInsertPayload(RequestInsertVertex myRequestInsertVertex)
        {
            this.VertexTypeName = myRequestInsertVertex.VertexTypeName;
            this.UUID           = myRequestInsertVertex.VertexUUID;
            this.Comment        = myRequestInsertVertex.Comment;
            this.Edition        = myRequestInsertVertex.Edition;

            this.StructuredProperties = (myRequestInsertVertex.StructuredProperties == null)
                ? null : myRequestInsertVertex.StructuredProperties.Select(x => new StructuredProperty(x.Key, x.Value)).ToArray();

            this.UnstructuredProperties = (myRequestInsertVertex.UnstructuredProperties == null)
                ? null : myRequestInsertVertex.UnstructuredProperties.Select(x => new UnstructuredProperty(x.Key, x.Value)).ToArray();

            this.Edges = (myRequestInsertVertex.OutgoingEdges == null)
                ? null : myRequestInsertVertex.OutgoingEdges.Select(x => new ServiceEdgePredefinition(x)).ToArray();
        }
Esempio n. 7
0
        public static RequestInsertVertex MakeRequestInsertVertex(String myVertexTypeName, ServiceInsertPayload myPayload)
        {
            RequestInsertVertex Request = new RequestInsertVertex(myVertexTypeName);

            if (!String.IsNullOrEmpty(myPayload.Comment))
            {
                Request.SetComment(myPayload.Comment);
            }

            if (!String.IsNullOrEmpty(myPayload.Edition))
            {
                Request.SetEdition(myPayload.Edition);
            }

            if (myPayload.UUID != null)
            {
                Request.SetUUID(myPayload.UUID.Value);
            }

            if (myPayload.StructuredProperties != null)
            {
                foreach (var toInsert in myPayload.StructuredProperties)
                {
                    Request.AddStructuredProperty(toInsert.PropertyName, toInsert.PropertyValue as IComparable);
                }
            }

            if (myPayload.UnstructuredProperties != null)
            {
                foreach (var toInsert in myPayload.UnstructuredProperties)
                {
                    Request.AddUnstructuredProperty(toInsert.PropertyName, toInsert.PropertyValue);
                }
            }

            if (myPayload.Edges != null)
            {
                foreach (var Edge in myPayload.Edges)
                {
                    Request.AddEdge(Edge.ToEdgePredefinition());
                }
            }


            return(Request);
        }
Esempio n. 8
0
        /// <summary>
        /// Reads the attributes of a vertex based on the attribute definitions.
        ///
        /// Updates the RequestInsertVertex with the read attributes.
        /// </summary>
        /// <param name='myReader'>
        /// XmlReader
        /// </param>
        /// <param name='myRequestInsertVertex'>
        /// RequestInsertVertex where the attributes will be added.
        /// </param>
        private void ReadVertexAttributes(XmlReader myReader, RequestInsertVertex myRequestInsertVertex)
        {
            using (var vertexDataReader = myReader.ReadSubtree())
            {
                //read attributes
                while (vertexDataReader.Read())
                {
                    if (vertexDataReader.Name == GraphMLTokens.DATA)
                    {
                        var key   = myReader.GetAttribute(GraphMLTokens.KEY);
                        var value = myReader.ReadElementContentAsString();

                        if (key != null)
                        {
                            var tupel = _AttributeDefinitions[key];

                            if (tupel != null)
                            {
                                var attrName = tupel.Item2;
                                var attrType = tupel.Item3;

                                if (value == null)             //use default value
                                {
                                    value = tupel.Item4;
                                }

                                if (attrType != null && value != null)
                                {
//									myRequestInsertVertex.AddStructuredProperty(attrName,
//										(IComparable)ParseValue(attrType, value));
                                    myRequestInsertVertex.AddUnknownProperty(attrName,
                                                                             Convert.ChangeType(ParseValue(attrType, value),
                                                                                                typeof(String),
                                                                                                CultureInfo.GetCultureInfo("en-us")));
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 9
0
        private static void ProcessUnstructuredAttribute(IVertexType vertexType,
                                                         AAttributeAssignOrUpdate aAttributeDefinition,
                                                         ref RequestInsertVertex result)
        {
            #region AttributeAssignOrUpdateValue

            if (aAttributeDefinition is AttributeAssignOrUpdateValue)
            {
                var value = aAttributeDefinition as AttributeAssignOrUpdateValue;

                result.AddUnstructuredProperty(value.AttributeIDChain.ContentString, value.Value);

                return;
            }

            #endregion

            else
            {
                throw new NotImplementedQLException("TODO");
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Inserts a vertex and its attributes into the GraphDB instance.
        /// </summary>
        /// <param name='myExternalVertexID'>
        /// the vertex id
        /// </param>
        private void InsertVertex(XmlReader myReader, String myExternalVertexID)
        {
            IVertex addedVertex = null;

            if (!_VertexIDMapper.ContainsKey(myExternalVertexID))
            {
                var insertRequest = new RequestInsertVertex(_VertexTypeName);
//				insertRequest.SetUUID(myVertexID);

                #region store Graphml VertexID

                insertRequest.AddStructuredProperty(GraphMLTokens.VERTEX_ID_NAME, myExternalVertexID);

                #endregion

                #region read vertex attributes

                ReadVertexAttributes(myReader, insertRequest);

                #endregion

                // insert vertex
                addedVertex = _GraphDB.Insert <IVertex>(
                    _SecurityToken,
                    _TransactionToken,
                    insertRequest,
                    (stats, v) => v
                    );

                if (addedVertex != null)
                {
                    // create mapping between external and internal VertexID
                    _VertexIDMapper.Add(myExternalVertexID, addedVertex.VertexID);
                }
            }
        }
Esempio n. 11
0
 /// <summary>
 /// Adds a vertex to the FS.
 /// </summary>
 /// <param name="myInsertDefinition">The insert request.</param>
 /// <param name="Int64">A transaction token for this operation.</param>
 /// <param name="SecurityToken">A security token for this operation.</param>
 /// <returns>The added vertex.</returns>
 public abstract IVertex AddVertex(RequestInsertVertex myInsertDefinition, Int64 myTransaction, SecurityToken mySecurity);
Esempio n. 12
0
        private static void ProcessStructuredProperty(GQLPluginManager myPluginManager,
                                                      IGraphDB myGraphDB,
                                                      SecurityToken mySecurityToken,
                                                      Int64 myTransactionToken,
                                                      IVertexType vertexType,
                                                      AAttributeAssignOrUpdate aAttributeDefinition,
                                                      ref RequestInsertVertex result)
        {
            #region AttributeAssignOrUpdateValue

            if (aAttributeDefinition is AttributeAssignOrUpdateValue)
            {
                var value = aAttributeDefinition as AttributeAssignOrUpdateValue;

                result.AddUnknownProperty(value.AttributeIDChain.ContentString, value.Value);

                return;
            }

            #endregion

            #region AttributeAssignOrUpdateList

            if (aAttributeDefinition is AttributeAssignOrUpdateList)
            {
                var value = aAttributeDefinition as AttributeAssignOrUpdateList;

                switch (value.CollectionDefinition.CollectionType)
                {
                case CollectionType.Set:

                    #region set

                    if (!vertexType.HasAttribute(aAttributeDefinition.AttributeIDChain.ContentString))
                    {
                        throw new InvalidVertexAttributeException(String.Format("The vertex type {0} has no attribute named {1}.",
                                                                                vertexType.Name,
                                                                                aAttributeDefinition.AttributeIDChain.ContentString));
                    }

                    IAttributeDefinition attribute = vertexType.GetAttributeDefinition(aAttributeDefinition
                                                                                       .AttributeIDChain
                                                                                       .ContentString);

                    EdgePredefinition edgeDefinition = new EdgePredefinition(value.AttributeIDChain.ContentString);

                    foreach (var aTupleElement in (TupleDefinition)value.CollectionDefinition.TupleDefinition)
                    {
                        if (aTupleElement.Value is BinaryExpressionDefinition)
                        {
                            #region BinaryExpressionDefinition

                            var targetVertexType = ((IOutgoingEdgeDefinition)attribute).TargetVertexType;

                            foreach (var aVertex in ProcessBinaryExpression(
                                         (BinaryExpressionDefinition)aTupleElement.Value,
                                         myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, targetVertexType))
                            {
                                var inneredge = new EdgePredefinition().AddVertexID(aVertex.VertexTypeID, aVertex.VertexID);

                                foreach (var aStructuredProperty in aTupleElement.Parameters)
                                {
                                    inneredge.AddUnknownProperty(aStructuredProperty.Key, aStructuredProperty.Value);
                                }

                                edgeDefinition.AddEdge(inneredge);
                            }

                            #endregion
                        }
                        else
                        {
                            throw new NotImplementedQLException("TODO");
                        }
                    }

                    result.AddEdge(edgeDefinition);

                    #endregion )

                    return;

                case CollectionType.List:

                    #region list

                    //has to be list of comparables
                    ListCollectionWrapper listWrapper = new ListCollectionWrapper();

                    Type myRequestedType;
                    if (vertexType.HasProperty(aAttributeDefinition.AttributeIDChain.ContentString))
                    {
                        myRequestedType = ((IPropertyDefinition)vertexType
                                           .GetAttributeDefinition(aAttributeDefinition.AttributeIDChain.ContentString)).BaseType;
                    }
                    else
                    {
                        myRequestedType = typeof(String);
                    }

                    foreach (var aTupleElement in (TupleDefinition)value.CollectionDefinition.TupleDefinition)
                    {
                        listWrapper.Add(((ValueDefinition)aTupleElement.Value).Value.ConvertToIComparable(myRequestedType));
                    }

                    result.AddStructuredProperty(aAttributeDefinition.AttributeIDChain.ContentString, listWrapper);

                    #endregion )

                    return;

                case CollectionType.SetOfUUIDs:

                    #region SetOfUUIDs

                    EdgePredefinition anotheredgeDefinition = new EdgePredefinition(value.AttributeIDChain.ContentString);

                    foreach (var aTupleElement in ((VertexTypeVertexIDCollectionNode)value.CollectionDefinition.TupleDefinition).Elements)
                    {
                        foreach (var aVertexIDTuple in aTupleElement.VertexIDs)
                        {
                            var innerEdge = new EdgePredefinition();

                            foreach (var aStructuredProperty in aVertexIDTuple.Item2)
                            {
                                innerEdge.AddUnknownProperty(aStructuredProperty.Key, aStructuredProperty.Value);
                            }

                            innerEdge.AddVertexID(aTupleElement.ReferencedVertexTypeName, aVertexIDTuple.Item1);

                            anotheredgeDefinition.AddEdge(innerEdge);
                        }
                    }

                    result.AddEdge(anotheredgeDefinition);

                    #endregion

                    return;

                default:
                    return;
                }
            }

            #endregion

            #region SetRefNode

            if (aAttributeDefinition is AttributeAssignOrUpdateSetRef)
            {
                var value = aAttributeDefinition as AttributeAssignOrUpdateSetRef;

                var edgeDefinition = new EdgePredefinition(value.AttributeIDChain.ContentString);

                if (value.SetRefDefinition.IsREFUUID)
                {
                    #region direct vertex ids

                    foreach (var aTupleElement in value.SetRefDefinition.TupleDefinition)
                    {
                        if (aTupleElement.Value is ValueDefinition)
                        {
                            #region ValueDefinition

                            foreach (var aProperty in aTupleElement.Parameters)
                            {
                                edgeDefinition.AddUnknownProperty(aProperty.Key, aProperty.Value);
                            }

                            edgeDefinition.AddVertexID(value.SetRefDefinition.ReferencedVertexType,
                                                       Convert.ToInt64(((ValueDefinition)aTupleElement.Value).Value));

                            #endregion
                        }
                        else
                        {
                            throw new NotImplementedQLException("TODO");
                        }
                    }

                    #endregion
                }
                else
                {
                    #region expression

                    if (!vertexType.HasAttribute(aAttributeDefinition.AttributeIDChain.ContentString))
                    {
                        throw new InvalidVertexAttributeException(String.Format("The vertex type {0} has no attribute named {1}.",
                                                                                vertexType.Name,
                                                                                aAttributeDefinition.AttributeIDChain.ContentString));
                    }
                    IAttributeDefinition attribute = vertexType.GetAttributeDefinition(aAttributeDefinition.AttributeIDChain.ContentString);

                    foreach (var aTupleElement in value.SetRefDefinition.TupleDefinition)
                    {
                        if (aTupleElement.Value is BinaryExpressionDefinition)
                        {
                            #region BinaryExpressionDefinition

                            var targetVertexType = ((IOutgoingEdgeDefinition)attribute).TargetVertexType;

                            var vertexIDs = ProcessBinaryExpression(
                                (BinaryExpressionDefinition)aTupleElement.Value,
                                myPluginManager, myGraphDB, mySecurityToken, myTransactionToken, targetVertexType).ToList();

                            if (vertexIDs.Count > 1)
                            {
                                throw new ReferenceAssignmentExpectedException(String.Format("It is not possible to create a single edge pointing to {0} vertices",
                                                                                             vertexIDs.Count));
                            }

                            var inneredge = new EdgePredefinition();

                            foreach (var aStructuredProperty in aTupleElement.Parameters)
                            {
                                edgeDefinition.AddUnknownProperty(aStructuredProperty.Key, aStructuredProperty.Value);
                            }

                            edgeDefinition.AddVertexID(vertexIDs.FirstOrDefault().VertexTypeID, vertexIDs.FirstOrDefault().VertexID);

                            #endregion
                        }
                        else
                        {
                            throw new NotImplementedQLException("");
                        }
                    }

                    #endregion
                }

                result.AddEdge(edgeDefinition);

                return;
            }

            #endregion
        }
Esempio n. 13
0
 public TResult Insert <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, Int64 myTransactionToken, RequestInsertVertex myRequestInsert, Converter.InsertResultConverter <TResult> myOutputconverter)
 {
     return(_iGraphDB.Insert <TResult>(mySecurityToken,
                                       myTransactionToken,
                                       myRequestInsert,
                                       myOutputconverter));
 }
Esempio n. 14
0
 public TResult Insert <TResult>(sones.Library.Commons.Security.SecurityToken mySecurityToken, Int64 myTransactionToken, RequestInsertVertex myRequestInsert, Converter.InsertResultConverter <TResult> myOutputconverter)
 {
     throw new NotImplementedException();
 }
Esempio n. 15
0
        /// <summary>
        /// Describes how to define a type with user defined properties and indices and create some instances by using GraphDB requests.
        /// </summary>
        private void GraphDBRequests()
        {
            #region define type "Tag"

            //create a VertexTypePredefinition
            var Tag_VertexTypePredefinition = new VertexTypePredefinition("Tag");

            //create property
            var PropertyName = new PropertyPredefinition("Name", "String")
                               .SetComment("This is a property on type 'Tag' named 'Name' and is of type 'String'");

            //add property
            Tag_VertexTypePredefinition.AddProperty(PropertyName);

            //create outgoing edge to "Website"
            var OutgoingEdgesTaggedWebsites = new OutgoingEdgePredefinition("TaggedWebsites", "Website")
                                              .SetMultiplicityAsMultiEdge()
                                              .SetComment(@"This is an outgoing edge on type 'Tag' wich points to the type 'Website' (the AttributeType) 
                                                                            and is defined as 'MultiEdge', which means that this edge can contain multiple single edges");

            //add outgoing edge
            Tag_VertexTypePredefinition.AddOutgoingEdge(OutgoingEdgesTaggedWebsites);

            #endregion

            #region define type "Website"

            //create a VertexTypePredefinition
            var Website_VertexTypePredefinition = new VertexTypePredefinition("Website");

            //create properties
            PropertyName = new PropertyPredefinition("Name", "String")
                           .SetComment("This is a property on type 'Website' named 'Name' and is of type 'String'");

            var PropertyUrl = new PropertyPredefinition("URL", "String")
                              .SetAsMandatory();

            //add properties
            Website_VertexTypePredefinition.AddProperty(PropertyName);
            Website_VertexTypePredefinition.AddProperty(PropertyUrl);

            #region create an index on type "Website" on property "Name"
            //there are three ways to set an index on property "Name"
            //Beware: Use just one of them!

            //1. create an index definition and specifie the property- and type name
            var MyIndex = new IndexPredefinition("MyIndex").SetIndexType("SonesIndex").AddProperty("Name").SetVertexType("Website");
            //add index
            Website_VertexTypePredefinition.AddIndex((IndexPredefinition)MyIndex);

            //2. on creating the property definition of property "Name" call the SetAsIndexed() method, the GraphDB will create the index
            //PropertyName = new PropertyPredefinition("Name")
            //                           .SetAttributeType("String")
            //                           .SetComment("This is a property on type 'Website' with name 'Name' and is of type 'String'")
            //                           .SetAsIndexed();

            //3. make a create index request, like creating a type
            //BEWARE: This statement must be execute AFTER the type "Website" is created.
            //var MyIndex = GraphDSServer.CreateIndex<IIndexDefinition>(SecToken,
            //                                                          TransToken,
            //                                                          new RequestCreateIndex(
            //                                                          new IndexPredefinition("MyIndex")
            //                                                                   .SetIndexType("SonesIndex")
            //                                                                   .AddProperty("Name")
            //                                                                   .SetVertexType("Website")), (Statistics, Index) => Index);

            #endregion

            //add IncomingEdge "Tags", the related OutgoingEdge is "TaggedWebsites" on type "Tag"
            Website_VertexTypePredefinition.AddIncomingEdge(new IncomingEdgePredefinition("Tags",
                                                                                          "Tag",
                                                                                          "TaggedWebsites"));

            #endregion

            #region create types by sending requests

            //create the types "Tag" and "Website"
            var DBTypes = _dsServer.CreateVertexTypes <IEnumerable <IVertexType> >(SecToken,
                                                                                   TransactionID,
                                                                                   new RequestCreateVertexTypes(
                                                                                       new List <VertexTypePredefinition> {
                Tag_VertexTypePredefinition,
                Website_VertexTypePredefinition
            }),
                                                                                   (Statistics, VertexTypes) => VertexTypes);

            /*
             * BEWARE: The following two operations won't work because the two types "Tag" and "Website" depending on each other,
             *          because one type has an incoming edge to the other and the other one has an incoming edge,
             *          so they cannot be created separate (by using create type),
             *          they have to be created at the same time (by using create types)
             *
             * //create the type "Website"
             * var Website = GraphDSServer.CreateVertexType<IVertexType>(SecToken,
             *                                                           TransToken,
             *                                                           new RequestCreateVertexType(Website_VertexTypePredefinition),
             *                                                           (Statistics, VertexType) => VertexType);
             *
             * //create the type "Tag"
             * var Tag = GraphDSServer.CreateVertexType<IVertexType>(SecToken,
             *                                                       TransToken,
             *                                                       new RequestCreateVertexType(Tag_VertexTypePredefinition),
             *                                                       (Statistics, VertexType) => VertexType);
             */

            var Tag = DBTypes.Where(type => type.Name == "Tag").FirstOrDefault();

            var Website = DBTypes.Where(type => type.Name == "Website").FirstOrDefault();

            #endregion

            #region insert some Websites by sending requests

            var cnn = _dsServer.Insert <IVertex>(SecToken, TransactionID, new RequestInsertVertex("Website")
                                                 .AddStructuredProperty("Name", "CNN")
                                                 .AddStructuredProperty("URL", "http://cnn.com/"),
                                                 (Statistics, Result) => Result);

            var xkcd = _dsServer.Insert <IVertex>(SecToken, TransactionID, new RequestInsertVertex("Website")
                                                  .AddStructuredProperty("Name", "xkcd")
                                                  .AddStructuredProperty("URL", "http://xkcd.com/"),
                                                  (Statistics, Result) => Result);

            var onion = _dsServer.Insert <IVertex>(SecToken, TransactionID, new RequestInsertVertex("Website")
                                                   .AddStructuredProperty("Name", "onion")
                                                   .AddStructuredProperty("URL", "http://theonion.com/"),
                                                   (Statistics, Result) => Result);

            //adding an unknown property means the property isn't defined before
            var test = _dsServer.Insert <IVertex>(SecToken, TransactionID, new RequestInsertVertex("Website")
                                                  .AddStructuredProperty("Name", "Test")
                                                  .AddStructuredProperty("URL", "")
                                                  .AddUnknownProperty("Unknown", "unknown property"),
                                                  (Statistics, Result) => Result);

            #endregion

            #region insert some Tags by sending requests

            //insert a "Tag" with an OutgoingEdge to a "Website" include that the GraphDB creates an IncomingEdge on the given Website instances
            //(because we created an IncomingEdge on type "Website") --> as a consequence we never have to set any IncomingEdge
            var bla = new RequestInsertVertex("Tag")
                      .AddStructuredProperty("Name", "good")
                      .AddEdge(new EdgePredefinition("TaggedWebsites")
                               .AddVertexID(Website.ID, cnn.VertexID)
                               .AddVertexID(Website.ID, xkcd.VertexID));
            var good = _dsServer.Insert <IVertex>(SecToken, TransactionID, bla,
                                                  (Statistics, Result) => Result);

            var funny = _dsServer.Insert <IVertex>(SecToken, TransactionID, new RequestInsertVertex("Tag")
                                                   .AddStructuredProperty("Name", "funny")
                                                   .AddEdge(new EdgePredefinition("TaggedWebsites")
                                                            .AddVertexID(Website.ID, xkcd.VertexID)
                                                            .AddVertexID(Website.ID, onion.VertexID)),
                                                   (Statistics, Result) => Result);

            #endregion

            #region how to get a type from the DB, properties of the type, instances of a specific type and read out property values

            //how to get a type from the DB
            var TagDBType = _dsServer.GetVertexType <IVertexType>(SecToken, TransactionID, new RequestGetVertexType(Tag.ID), (Statistics, Type) => Type);

            //read informations from type
            var typeName = TagDBType.Name;
            //are there other types wich extend the type "Tag"
            var hasChildTypes = TagDBType.HasChildTypes;
            //get the definition of the property "Name"
            var propName = TagDBType.GetPropertyDefinition("Name");

            //how to get all instances of a type from the DB
            var TagInstances = _dsServer.GetVertices(SecToken, TransactionID, new RequestGetVertices(TagDBType.ID), (Statistics, Vertices) => Vertices);

            foreach (var item in TagInstances)
            {
                //to get the value of a property of an instance, you need the property ID
                //(that's why we fetched the type from DB an read out the property definition of property "Name")
                var name = item.GetPropertyAsString(propName.ID);
            }

            #endregion
        }