private void UpdateValueTypeInMapping <X, Y>(Value currentValue, Pair <X, Y> key, IDictionary <Pair <X, Y>, ValueTypeListHelper> mappingToUpdate) { ValueTypeListHelper helper = mappingToUpdate[key]; if (helper == null) { helper = new ValueTypeListHelper(this, currentValue); mappingToUpdate[key] = helper; } else { helper.UpdateValueTypesWith(currentValue); } }
private IList <NodePropertySchemaInfoResult> ProduceResultsForNodes(NodeMappings nodeMappings) { IList <NodePropertySchemaInfoResult> results = new List <NodePropertySchemaInfoResult>(); foreach (SortedLabels labelSet in nodeMappings.LabelSetToPropertyKeys.Keys) { // lookup label names and produce list of names and produce String out of them IList <string> labelNames = new List <string>(); for (int i = 0; i < labelSet.NumberOfLabels(); i++) { string name = nodeMappings.LabelIdToLabelName[labelSet.Label(i)]; labelNames.Add(name); } labelNames.Sort(); // this is optional but waaaaay nicer StringBuilder labelsConcatenator = new StringBuilder(); foreach (string item in labelNames) { labelsConcatenator.Append(":`").Append(item).Append("`"); } string labels = labelsConcatenator.ToString(); // lookup property value types MutableIntSet propertyIds = nodeMappings.LabelSetToPropertyKeys[labelSet]; if (propertyIds.size() == 0) { results.Add(new NodePropertySchemaInfoResult(labels, labelNames, null, null, false)); } else { propertyIds.forEach(propId => { string propName = _propertyIdToPropertyNameMapping[propId]; ValueTypeListHelper valueTypeListHelper = nodeMappings.LabelSetANDNodePropertyKeyIdToValueType[Pair.of(labelSet, propId)]; if (nodeMappings.NullableLabelSets.Contains(labelSet)) { results.Add(new NodePropertySchemaInfoResult(labels, labelNames, propName, valueTypeListHelper.CypherTypesList, false)); } else { results.Add(new NodePropertySchemaInfoResult(labels, labelNames, propName, valueTypeListHelper.CypherTypesList, valueTypeListHelper.Mandatory)); } }); } } return(results); }
private IList <RelationshipPropertySchemaInfoResult> ProduceResultsForRelationships(RelationshipMappings relMappings) { IList <RelationshipPropertySchemaInfoResult> results = new List <RelationshipPropertySchemaInfoResult>(); foreach (int?typeId in relMappings.RelationshipTypeIdToPropertyKeys.Keys) { // lookup typ name string name = relMappings.RelationshipTypIdToRelationshipName[typeId]; name = ":`" + name + "`"; // escaping // lookup property value types MutableIntSet propertyIds = relMappings.RelationshipTypeIdToPropertyKeys[typeId]; if (propertyIds.size() == 0) { results.Add(new RelationshipPropertySchemaInfoResult(name, null, null, false)); } else { string finalName = name; propertyIds.forEach(propId => { string propName = _propertyIdToPropertyNameMapping[propId]; ValueTypeListHelper valueTypeListHelper = relMappings.RelationshipTypeIdANDPropertyTypeIdToValueType[Pair.of(typeId, propId)]; if (relMappings.NullableRelationshipTypes.Contains(typeId)) { results.Add(new RelationshipPropertySchemaInfoResult(finalName, propName, valueTypeListHelper.CypherTypesList, false)); } else { results.Add(new RelationshipPropertySchemaInfoResult(finalName, propName, valueTypeListHelper.CypherTypesList, valueTypeListHelper.Mandatory)); } }); } } return(results); }