Skip to content

WotCon.Server: no way to map WoT properties onto OPC UA companion specification types #4107

Closed

Description

@barnstee

Summary

Opc.Ua.WotCon.Server maps Thing Description properties onto OPC UA variables using only JSON-schema
primitive types. There is no way to map a WoT property onto a type from an OPC UA companion
specification
(e.g. an ObjectType from a Companion Spec, or a field within a StructureType).

Detail

ThingDescriptions/WotPropertyMapper.cs
resolves the DataType/ValueRank purely from the JSON-schema type keyword:

  • boolean -> DataTypeIds.Boolean
  • number -> DataTypeIds.Double
  • integer -> DataTypeIds.Int64
  • string -> DataTypeIds.String
  • array -> ValueRanks.OneDimension of the element type

Neither ThingDescriptions/ThingDescription.cs
nor Providers/WotPropertyTag.cs
carries any notion of a target OPC UA type or node.

Why this matters

The main value of the WoT-Connectivity approach is normalising proprietary asset data into a
standardised OPC UA information model
, not just exposing it as loose primitives. Without
companion-spec mapping, the resulting address space is a flat set of Double/String variables.

UA Edge Translator implements this today with
three JSON-LD annotations on a TD property form:

Annotation Purpose
uav:mapToNodeId The target OPC UA NodeId the property value should be surfaced on
uav:mapToType The companion-spec type (ObjectType / VariableType / DataType) to instantiate
uav:mapByFieldPath The dot-notation field path inside a structured DataType

These are produced interactively by the
UA-WoTMapper drag-and-drop tool.

Suggested direction

  1. Extend the TD model so property forms can carry an optional target type / node id / field path.
  2. In WotPropertyMapper, when a target type is present, resolve it from the server's
    NamespaceUris/type tree and instantiate the corresponding ObjectType children instead of
    creating a primitive variable.
  3. Surface the resolved target on WotPropertyTag so providers can address the correct field.

Happy to contribute the mapping logic from UA Edge Translator if that is useful.

Context

Found while evaluating whether UA Edge Translator can replace its hand-written WoT-Connectivity
node manager with this library. This is currently the single largest blocker.

Activity

  1. self-assigned this
    on Jul 29, 2026
  2. added
    enhancement
    and removed on Jul 29, 2026
  3. marcschier commented on Jul 29, 2026

    @marcschier
    Collaborator

    Thanks — this is already implemented in #4093, and standardised rather than vendor-specific.

    Where to look. The files you cite (ThingDescriptions/WotPropertyMapper.cs, Providers/WotPropertyTag.cs) are the OPC 10100-1 v1.02 asset surface. #4093 keeps that for compatibility but adds a registry-first materialization runtime plus Opc.Ua.WotCon.Bindings, and target mapping lives there.

    What ships. uav:mapToNodeId, uav:mapToType and uav:mapByFieldPath are implemented per OPC 10101 §6.5.4, with the protocol-neutral example in §8.2 — i.e. the standardised form of exactly what UA Edge Translator does today:

    • WotTargetMappingDescriptor / WotAffordanceForm.TargetMapping — parsing
    • WotProtocolBinderRegistry.Prepare — validates once for every protocol and attaches the mapping to every compiled form, so individual planners never re-parse it
    • IWotTargetVariableResolver, WotStructuredFieldBinding, WotStructuredGroupState — resolution and structured-field write-back

    Covered by WotTargetMappingTests, WotTargetVariableResolverTests and WotMappingValidationTests, with a worked example in tests/Opc.Ua.WotCon.Tests/Resources/WotAggregation/StructuredPumpMappingExample.td.json. Documented in docs/WotBindings.md and docs/WoTConnectivity.md.

    One deliberate difference worth knowing before you port anything. The terms are authored on the property affordance, never on a form — you proposed a form annotation. That is what the spec requires, and it is validated: mapByFieldPath requires mapToType, values must be non-empty, and authoring any of them on a form is rejected with a diagnostic carrying an RFC 6901 JSON Pointer. Portable nsu= NodeIds resolve against the runtime generation's namespace table.

    Prerequisite-wise you were right that this needs the target type to exist first — see #4109 (now has a hook for programmatically generated DataTypes) and #4108.

    Labelled enhancement; the mapping itself needs no further work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions