Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a few more pieces of missing metadata #479

Merged
merged 1 commit into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Extractor/Nodes/UAReferenceType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ namespace Cognite.OpcUa.Nodes
public class ReferenceTypeAttributes : BaseNodeAttributes
{
public string? InverseName { get; set; }
public bool IsAbstract { get; set; }
public ReferenceTypeAttributes() : base(NodeClass.ReferenceType)
{
}

public override IEnumerable<uint> GetAttributeSet(FullConfig config)
{
yield return Attributes.InverseName;
yield return Attributes.IsAbstract;
foreach (var attr in base.GetAttributeSet(config)) yield return attr;
}

Expand All @@ -44,6 +46,9 @@ public override void LoadAttribute(DataValue value, uint attributeId, TypeManage
case Attributes.InverseName:
InverseName = value.GetValue<LocalizedText?>(null)?.Text;
break;
case Attributes.IsAbstract:
IsAbstract = value.GetValue(false);
break;
default:
base.LoadAttribute(value, attributeId, typeManager);
break;
Expand All @@ -53,6 +58,7 @@ public override void LoadAttribute(DataValue value, uint attributeId, TypeManage
public void LoadFromNodeState(ReferenceTypeState state)
{
InverseName = state.InverseName?.Text;
IsAbstract = state.IsAbstract;
LoadFromBaseNodeState(state);
}
}
Expand Down
7 changes: 7 additions & 0 deletions Extractor/Pushers/FDM/BaseDataModelDefinitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ public static ContainerCreate ReferenceType(string space)
UsedFor = UsedFor.node,
Properties = new Dictionary<string, ContainerPropertyDefinition>
{
{ "IsAbstract", new ContainerPropertyDefinition
{
Type = BasePropertyType.Create(PropertyTypeVariant.boolean),
Nullable = false,
Name = "IsAbstract",
DefaultValue = new RawPropertyValue<bool>(false)
} },
{ "InverseName", new ContainerPropertyDefinition
{
Type = BasePropertyType.Text(),
Expand Down
3 changes: 3 additions & 0 deletions Extractor/Pushers/FDM/InstanceBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,13 @@ class ReferenceTypeData
[JsonPropertyName("InverseName")]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
public string? InverseName { get; }
[JsonPropertyName("IsAbstract")]
public bool IsAbstract { get; }

public ReferenceTypeData(UAReferenceType node)
{
InverseName = node.FullAttributes.InverseName;
IsAbstract = node.FullAttributes.IsAbstract;
}
}

Expand Down
2 changes: 2 additions & 0 deletions Extractor/Pushers/FDM/TypeMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class PropertyNode
public string? ReferenceType { get; set; }
public string? DisplayName { get; set; }
public string? ExternalId { get; set; }
public string? Description { get; set; }
public bool IsTimeseries { get; set; }
}


Expand Down
4 changes: 3 additions & 1 deletion Extractor/Pushers/FDM/Types/NodeTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ public TypeMetadata GetTypeMetadata()
IsMandatory = pair.mandatory,
ReferenceType = pair.reference.Type.Id.ToString(),
DisplayName = pair.node.Name ?? "",
ExternalId = FDMUtils.SanitizeExternalId(pair.node.Name ?? "")
ExternalId = FDMUtils.SanitizeExternalId(pair.node.Name ?? ""),
IsTimeseries = !pair.node.IsRawProperty && pair.node.NodeClass == NodeClass.Variable,
Description = pair.node.Attributes.Description
};

if (pair.node is UAVariable nVar)
Expand Down
Loading