/// <summary> /// Converts the given unknown attribute predefinition to an outgoing edge predfeinition. /// </summary> /// <param name="unknown">The unknown attribute predegfinition.</param> /// <returns>The created outgoing edge predefinition.</returns> private static OutgoingEdgePredefinition ConvertUnknownToOutgoingEdge(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) { throw new Exception("A default value is not allowed on a unknown property."); } var prop = new OutgoingEdgePredefinition(unknown.AttributeName, unknown.AttributeType) .SetEdgeType(unknown.EdgeType) .SetComment(unknown.Comment); if (unknown.Multiplicity != null) { switch (unknown.Multiplicity) { case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityAsMultiEdge(unknown.InnerEdgeType); break; default: throw new Exception("Unknown multiplicity for edges."); } } return(prop); }
public OutgoingEdgePredefinition ToOutgoingEdgePredefinition() { OutgoingEdgePredefinition OutgoingEdgePreDef = new OutgoingEdgePredefinition(this.AttributeName, this.AttributeType); OutgoingEdgePreDef.SetAttributeType(this.AttributeType); OutgoingEdgePreDef.SetComment(this.Comment); OutgoingEdgePreDef.SetEdgeType(this.EdgeType); OutgoingEdgePreDef.InnerEdgeType = this.InnerEdgeType; if (this.Multiplicity == ServiceEdgeMultiplicity.HyperEdge) { OutgoingEdgePreDef.SetMultiplicityAsHyperEdge(); } if (this.Multiplicity == ServiceEdgeMultiplicity.MultiEdge) { OutgoingEdgePreDef.SetMultiplicityAsMultiEdge(); } return(OutgoingEdgePreDef); }
/// <summary> /// Creates the vertexType based on the VertexTypeName. /// /// The vertexType contains one Outgoing Edge Defintion, the edge /// is weighted and can't contain any other attributes. /// </summary> private void CreateVertexType() { #region create vertex type var vertexTypePreDef = new VertexTypePredefinition(_VertexTypeName); var outEdgePreDef = new OutgoingEdgePredefinition(_EdgeTypeName, vertexTypePreDef); #region create edge definition // weighted multi-edge outEdgePreDef.SetEdgeTypeAsWeighted(); // set inner edge type to weighted outEdgePreDef.SetMultiplicityAsMultiEdge("Weighted"); vertexTypePreDef.AddOutgoingEdge(outEdgePreDef); #endregion #region create id definition var idPreDefinition = new PropertyPredefinition(GraphMLTokens.VERTEX_ID_NAME, GraphMLTokens.VERTEX_ID_TYPE); idPreDefinition.SetDefaultValue(GraphMLTokens.VERTEX_ID_DEF_VAL); vertexTypePreDef.AddProperty(idPreDefinition); #endregion #region create vertex type var requestCreateVertexType = new RequestCreateVertexType(vertexTypePreDef); _GraphDB.CreateVertexType(_SecurityToken, _TransactionToken, requestCreateVertexType, (stats, vType) => vType); #endregion #endregion }
public OutgoingEdgePredefinition ToOutgoingEdgePredefinition() { OutgoingEdgePredefinition OutgoingEdgePreDef = new OutgoingEdgePredefinition(this.AttributeName,this.AttributeType); OutgoingEdgePreDef.SetAttributeType(this.AttributeType); OutgoingEdgePreDef.SetComment(this.Comment); OutgoingEdgePreDef.InnerEdgeType = this.InnerEdgeType; if (this.Multiplicity == ServiceEdgeMultiplicity.HyperEdge) OutgoingEdgePreDef.SetMultiplicityAsHyperEdge(); if (this.Multiplicity == ServiceEdgeMultiplicity.MultiEdge) OutgoingEdgePreDef.SetMultiplicityAsMultiEdge(); return OutgoingEdgePreDef; }
/// <summary> /// Creates the vertexType based on the VertexTypeName. /// /// The vertexType contains one Outgoing Edge Defintion, the edge /// is weighted and can't contain any other attributes. /// </summary> private void CreateVertexType() { #region create vertex type var vertexTypePreDef = new VertexTypePredefinition(_VertexTypeName); var outEdgePreDef = new OutgoingEdgePredefinition(_EdgeTypeName, vertexTypePreDef); #region create edge definition // weighted multi-edge outEdgePreDef.SetEdgeTypeAsWeighted(); // set inner edge type to weighted outEdgePreDef.SetMultiplicityAsMultiEdge("Weighted"); vertexTypePreDef.AddOutgoingEdge(outEdgePreDef); #endregion #region create id definition var idPreDefinition = new PropertyPredefinition(GraphMLTokens.VERTEX_ID_NAME , GraphMLTokens.VERTEX_ID_TYPE); idPreDefinition.SetDefaultValue(GraphMLTokens.VERTEX_ID_DEF_VAL); vertexTypePreDef.AddProperty(idPreDefinition); #endregion #region create vertex type var requestCreateVertexType = new RequestCreateVertexType(vertexTypePreDef); _GraphDB.CreateVertexType(_SecurityToken, _TransactionToken, requestCreateVertexType, (stats, vType) => vType); #endregion #endregion }
private static OutgoingEdgePredefinition ConvertUnknownToOutgoingEdge(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) throw new Exception("A default value is not allowed on a binary property."); var prop = new OutgoingEdgePredefinition(unknown.AttributeName) .SetAttributeType(unknown.AttributeType) .SetEdgeType(unknown.EdgeType) .SetComment(unknown.Comment); if (unknown.Multiplicity != null) switch (unknown.Multiplicity) { case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityAsMultiEdge(unknown.InnerEdgeType); break; default: throw new Exception("Unknown multiplicity for edges."); } return prop; }