Closed polnischfrosch closed 12 months ago
I investigated this a bit. The "duplication" is in fact a more of a redundant repetition: the first occurrence is the properties of "IBHoMObject", the second occurrence is the properties of "BHoMObject". I may have introduced this bug by mistake when fixing an earlier issue, hard to say which one. The C# test we can use to verify is much simpler, just export any CustomObject with a single or no property at all. For example:
[Test]
public static void IndividualsDuplicatedData()
{
// Targets https://github.com/BHoM/RDF_Prototypes/issues/109
CustomObject testObj = new CustomObject();
CSharpGraph cSharpGraph_customObj = Compute.CSharpGraph(new List<object>() { testObj }, m_graphSettings);
string TTLGraph = cSharpGraph_customObj.ToTTL();
Assert.IsTTLParsable(TTLGraph);
// Check how many times the BHoM_Guid property appears in the TTL text.
string guidIndividualProperty = $":BH.oM.Base.BHoMObject.BHoM_Guid \"{testObj.BHoM_Guid}\"^^xsd:string;";
int repetitionOfGuidProperty = Regex.Matches(TTLGraph, guidIndividualProperty).Count;
// Verify that the number of repetitions is equal to 1.
repetitionOfGuidProperty.ShouldBe(1); // this fails.
}
This is linked to https://github.com/BHoM/RDF_Prototypes/issues/49.
They need to be solved in parallel.
Description (edited by @alelom)
Currently, the Data and Object Properties are "duplicated" (#49) in the CSharpGraph. This also corresponds to a duplication of individuals' relations (IndividualDataProperty/IndividualObjectProperty) in the CSharpGraph.
As a result, other than the effect noticed for #49, and the fact that the Data and Object Properties are reported for each class in the chain of parent classes of a type, we also have the following effect: when serializing to a format like TTL, we get duplicate properties in the individuals' section. For example:
Expected behaviour:
Only singular occurrence of a property should appear in an individual's section.
Test file(s):
TTLOutput.txt IndividualPropertiesShowUpTwice.zip