/// <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); }
/// <summary> /// Generates a attribute definition /// </summary> /// <param name="aAttribute">The attribute that is going to be transfered</param> /// <returns>A attribute predefinition</returns> private UnknownAttributePredefinition GenerateUnknownAttribute(AttributeDefinition myAttributeDefinition) { UnknownAttributePredefinition result = new UnknownAttributePredefinition(myAttributeDefinition.AttributeName, myAttributeDefinition.AttributeType.Name); if (myAttributeDefinition.AttributeType.EdgeType != null) { result.SetInnerEdgeType(myAttributeDefinition.AttributeType.EdgeType); } if (myAttributeDefinition.DefaultValue != null) { result.SetDefaultValue(myAttributeDefinition.DefaultValue.ToString()); } switch (myAttributeDefinition.AttributeType.Type) { case SonesGQLGrammar.TERMINAL_SET: result.SetMultiplicityAsSet(); break; case SonesGQLGrammar.TERMINAL_LIST: result.SetMultiplicityAsList(); break; } return(result); }
internal ServiceUnknownAttributePredefinition(UnknownAttributePredefinition myPredef) : base(myPredef) { DefaultValue = myPredef.DefaultValue; EdgeType = myPredef.EdgeType; InnerEdgeType = myPredef.InnerEdgeType; IsMandatory = myPredef.IsMandatory; IsUnique = myPredef.IsUnique; Multiplicity = myPredef.Multiplicity; }
/// <summary> /// Defines an attribute /// </summary> /// <param name="myUnknownPredefinition">The unknwown property definition that is going to be defined</param> /// <returns>The reference of the current object. (fluent interface).</returns> public RequestAlterVertexType DefineAttribute(UnknownAttributePredefinition myUnknownPredefinition) { if (myUnknownPredefinition != null) { _toBeDefinedAttributes = (_toBeDefinedAttributes) ?? new List <AAttributePredefinition>(); _toBeDefinedAttributes.Add(myUnknownPredefinition); DefineAttributeCount++; } return(this); }
/// <summary> /// Adds an unknown property to the type definition /// </summary> /// <param name="myUnknownPredefinition">The unknwown property definition that is going to be added</param> /// <returns>The reference of the current object. (fluent interface).</returns> public RequestAlterEdgeType AddUnknownAttribute(UnknownAttributePredefinition myUnknownPredefinition) { if (myUnknownPredefinition != null) { _toBeAddedAttributes = (_toBeAddedAttributes) ?? new List <AAttributePredefinition>(); _toBeAddedAttributes.Add(myUnknownPredefinition); AddUnknownPropertyCount++; } return(this); }
/// <summary> /// Generates a attribute definition /// </summary> /// <param name="aAttribute">The attribute that is going to be transfered</param> /// <returns>A attribute predefinition</returns> private UnknownAttributePredefinition GenerateUnknownAttribute(KeyValuePair <AttributeDefinition, string> aAttribute) { UnknownAttributePredefinition result = new UnknownAttributePredefinition(aAttribute.Key.AttributeName, aAttribute.Value); if (aAttribute.Key.AttributeType.EdgeType != null) { result.SetInnerEdgeType(aAttribute.Key.AttributeType.EdgeType); } if (aAttribute.Key.DefaultValue != null) { result.SetDefaultValue(aAttribute.Key.DefaultValue.ToString()); } switch (aAttribute.Key.AttributeType.Type) { case SonesGQLGrammar.TERMINAL_SET: result.SetMultiplicityAsSet(); break; case SonesGQLGrammar.TERMINAL_LIST: result.SetMultiplicityAsList(); break; } if (aAttribute.Key.DefaultValue != null) { result.SetDefaultValue(aAttribute.Key.DefaultValue.ToString()); } if (aAttribute.Key.AttributeType.TypeCharacteristics.IsMandatory) { result.SetAsMandatory(); } if (aAttribute.Key.AttributeType.TypeCharacteristics.IsUnique) { result.SetAsUnique(); } return(result); }
public UnknownAttributePredefinition ToUnknownAttributePredefinition() { var attributePredef = new UnknownAttributePredefinition(this.AttributeName, this.AttributeType); attributePredef.SetMultiplicity(this.Multiplicity); attributePredef.SetDefaultValue(this.DefaultValue); attributePredef.SetEdgeType(this.EdgeType); attributePredef.SetInnerEdgeType(this.InnerEdgeType); if (this.IsMandatory == true) { attributePredef.SetAsMandatory(); } if (this.IsUnique == true) { attributePredef.SetAsUnique(); } return(attributePredef); }
/// <summary> /// Converts the unknown properties into properties / edges. /// </summary> /// <param name="myUnknown">The unknown property predefinition.</param> /// <returns>The property predefinition.</returns> protected static PropertyPredefinition ConvertUnknownToProperty(UnknownAttributePredefinition myUnknown) { if (myUnknown.EdgeType != null) { throw new Exception("An edge type is not allowed on a property."); } var prop = new PropertyPredefinition(myUnknown.AttributeName, myUnknown.AttributeType) .SetDefaultValue(myUnknown.DefaultValue) .SetComment(myUnknown.Comment); if (myUnknown.IsUnique) { prop.SetAsUnique(); } if (myUnknown.IsMandatory) { prop.SetAsMandatory(); } if (myUnknown.Multiplicity != null) { switch (myUnknown.Multiplicity) { case UnknownAttributePredefinition.LISTMultiplicity: prop.SetMultiplicityToList(); break; case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityToSet(); break; default: throw new Exception("Unknown multiplicity for properties."); } } return(prop); }
/// <summary> /// Converts the given unknown attribute predefinition to a binary property predfeinition. /// </summary> /// <param name="unknown">The unknown attribute predegfinition.</param> /// <returns>The created binary property predefinition.</returns> private static BinaryPropertyPredefinition ConvertUnknownToBinaryProperty(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) { throw new Exception("A default value is not allowed on a binary property."); } if (unknown.EdgeType != null) { throw new Exception("An edge type is not allowed on a binary property."); } if (unknown.Multiplicity != null) { throw new Exception("A multiplicity is not allowed on a binary property."); } var prop = new BinaryPropertyPredefinition(unknown.AttributeName, unknown.AttributeType) .SetComment(unknown.Comment); return(prop); }
/// <summary> /// Converts the given unknown attribute predefinition to an incoming edge predfeinition. /// </summary> /// <param name="unknown">The unknown attribute predegfinition.</param> /// <returns>The created incoming edge predefinition.</returns> private static IncomingEdgePredefinition ConvertUnknownToIncomingEdge(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) { throw new Exception("A default value is not allowed on an incoming edge."); } if (unknown.EdgeType != null) { throw new Exception("An edge type is not allowed on an incoming edge."); } if (unknown.Multiplicity != null) { throw new Exception("A multiplicity is not allowed on an incoming edge."); } var prop = new IncomingEdgePredefinition(unknown.AttributeType, GetTargetVertexTypeFromAttributeType(unknown.AttributeType), GetTargetEdgeNameFromAttributeType(unknown.AttributeType)) .SetComment(unknown.Comment); return(prop); }
/// <summary> /// Generates a attribute definition /// </summary> /// <param name="aAttribute">The attribute that is going to be transfered</param> /// <returns>A attribute predefinition</returns> private UnknownAttributePredefinition GenerateUnknownAttribute(KeyValuePair<AttributeDefinition, string> aAttribute) { UnknownAttributePredefinition result = new UnknownAttributePredefinition(aAttribute.Key.AttributeName); result.SetAttributeType(aAttribute.Value); if (aAttribute.Key.AttributeType.EdgeType != null) { result.SetInnerEdgeType(aAttribute.Key.AttributeType.EdgeType); } if (aAttribute.Key.DefaultValue != null) { result.SetDefaultValue(aAttribute.Key.DefaultValue.ToString()); } switch (aAttribute.Key.AttributeType.Type) { case SonesGQLGrammar.TERMINAL_SET: result.SetMultiplicityAsSet(); break; case SonesGQLGrammar.TERMINAL_LIST: result.SetMultiplicityAsList(); break; } if (aAttribute.Key.DefaultValue != null) result.SetDefaultValue(aAttribute.Key.DefaultValue.ToString()); if (aAttribute.Key.AttributeType.TypeCharacteristics.IsMandatory) result.SetAsMandatory(); if (aAttribute.Key.AttributeType.TypeCharacteristics.IsUnique) result.SetAsUnique(); return result; }
private static PropertyPredefinition ConvertUnknownToProperty(UnknownAttributePredefinition unknown) { if (unknown.EdgeType != null) throw new Exception("An edge type is not allowed on a property."); var prop = new PropertyPredefinition(unknown.AttributeName) .SetDefaultValue(unknown.DefaultValue) .SetAttributeType(unknown.AttributeType) .SetComment(unknown.Comment); if (unknown.IsUnique) prop.SetAsUnique(); if (unknown.IsMandatory) prop.SetAsMandatory(); if (unknown.Multiplicity != null) switch (unknown.Multiplicity) { case UnknownAttributePredefinition.LISTMultiplicity: prop.SetMultiplicityToList(); break; case UnknownAttributePredefinition.SETMultiplicity: prop.SetMultiplicityToSet(); break; default: throw new Exception("Unknown multiplicity for properties."); } return prop; }
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; }
private static IncomingEdgePredefinition ConvertUnknownToIncomingEdge(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) throw new Exception("A default value is not allowed on an incoming edge."); if (unknown.EdgeType != null) throw new Exception("An edge type is not allowed on an incoming edge."); if (unknown.Multiplicity != null) throw new Exception("A multiplicity is not allowed on an incoming edge."); var prop = new IncomingEdgePredefinition(unknown.AttributeType) .SetComment(unknown.Comment) .SetOutgoingEdge(GetTargetVertexTypeFromAttributeType(unknown.AttributeType), GetTargetEdgeNameFromAttributeType(unknown.AttributeType)); return prop; }
private static BinaryPropertyPredefinition ConvertUnknownToBinaryProperty(UnknownAttributePredefinition unknown) { if (unknown.DefaultValue != null) throw new Exception("A default value is not allowed on a binary property."); if (unknown.EdgeType != null) throw new Exception("An edge type is not allowed on a binary property."); if (unknown.Multiplicity != null) throw new Exception("A multiplicity is not allowed on a binary property."); var prop = new BinaryPropertyPredefinition(unknown.AttributeName) .SetComment(unknown.Comment); return prop; }
/// <summary> /// Generates a attribute definition /// </summary> /// <param name="aAttribute">The attribute that is going to be transfered</param> /// <returns>A attribute predefinition</returns> private UnknownAttributePredefinition GenerateUnknownAttribute(AttributeDefinition myAttributeDefinition) { UnknownAttributePredefinition result = new UnknownAttributePredefinition(myAttributeDefinition.AttributeName); result.SetAttributeType(myAttributeDefinition.AttributeType.Name); if (myAttributeDefinition.AttributeType.EdgeType != null) { result.SetInnerEdgeType(myAttributeDefinition.AttributeType.EdgeType); } if (myAttributeDefinition.DefaultValue != null) { result.SetDefaultValue(myAttributeDefinition.DefaultValue.ToString()); } switch (myAttributeDefinition.AttributeType.Type) { case SonesGQLGrammar.TERMINAL_SET: result.SetMultiplicityAsSet(); break; case SonesGQLGrammar.TERMINAL_LIST: result.SetMultiplicityAsList(); break; } return result; }