BlockML Documentation

Primitive Entities

When a primitive value needs to be an instance

core:PrimitiveEntity is the abstract wrapper that lets a primitive value appear as a Block instance — needed only where an instance is required, such as inside an aggregation, not wherever a primitive value merely needs to exist.

Binding T and the value member

A concrete specialization such as type:TextEntity binds PrimitiveEntity's generic parameter T through baseType, which yields a normal, instantiable Block carrying a single property named value.

Because the member's name genuinely is value, an instance writes value="…" directly — this is ordinary instance syntax for that member, not the definition-only value wrapper that other Properties must never use.

Why an aggregation needs the wrapper

A bare Property already stores a primitive value directly; a PrimitiveEntity is needed only when that same kind of value must appear as a child inside an aggregation, which requires a Block instance rather than a scalar value.

Collecting keywords as PrimitiveEntity instances

An aggregation whose payload type is a concrete PrimitiveEntity holds each value as one child instance, each with its own value attribute.

<!-- Widget declares "keywords" as an aggregation of TextEntity instances -->
<acme:Widget xmlns="http://blockml.org/bml"
  xmlns:acme="com.acme.example"
  xmlns:core="org.blockml.bml.core"
  xmlns:type="org.blockml.bml.type">

  <baseType>
    core:Block
  </baseType>
  <aggregations>
    <keywords type="type:TextEntity">
      <composition>
        <type:TextEntity value="fastener" />
        <type:TextEntity value="hardware" />
      </composition>
    </keywords>
  </aggregations>
</acme:Widget>

Each of the two strings, fastener and hardware, needed to become an aggregation child, so each one is wrapped as a TextEntity instance whose value attribute carries it — a bare Property could not hold more than one such value at all.

What to carry into the next pages

After this page, readers should know when a bare Property value is not enough and a PrimitiveEntity wrapper is needed instead, before the next page states the type-versus-value principle these first four pages all rest on.

Continue with types and values