[Nexus] NXDL technical meetings: poll for meeting on NX_class
Paul Millar
paul.millar at desy.de
Mon Nov 9 22:06:56 GMT 2026
Hi Wout,
On 09/11/2026 17:16, Wout De Nolf via NeXus wrote:
[...]
> But if NX_class is an HDF5 attribute but not a NeXus attribute, then
> what is it?
Here are some off-the-cuff thoughts...
This distinction sounds a little like something where Description Logics
(DL) might offer an insight.
I've only really dabbled in DL: RDF and OWL are defined in terms of DL,
which is where I've encountered it. I believe the NeXus ontology is
defined use OWL, so there's a natural link between NeXus and DL through
the NeXus ontology.
From my limited knowledge, DL introduces the concepts of the TBox
(Terminology Box) and the ABox (Assertion Box). I believe more modern
DLs (needed for OWL2, for example) introduce the RBox, but I don't think
RBox matters, here.
In NeXus, the classes (as defined using the NXDL language) provide the
TBox assertions. The actual attributes present within an HDF5 file
define the ABox assertions.
TBox assertions don't care if individuals exist. We could use NXDL to
define a new NeXus base class (NXtachyon_monochromator, for example)
without having any actual HDF5 files that makes use of that NeXus class.
The ABox assertions describe specific individuals (the undulator in
PETRA III P08 or the motor positions during a specific experiment, for
example). In NeXus, this is all the information gleaned from some
specific HDF5 files.
ABox assertions may be split into two types: Concept Assertions and Role
Assertions. The Concept Assertions describe the nature of the thing (a
class) while Role Assertions describe relationships between instances
(this specific beamline has this specific undulator) and attributes
(information about the thing).
In an HDF5 file, the information about which NeXus base class applies to
some HDF5 group is a Concept Assertion. The NeXus attributes are the
Role Assertions. Both together form the ABox.
In HDF5, all metadata is stored as HDF5 attributes and fields, so the
ABox (both Concept Assertions and Role Assertions) can only come from
attributes and fields in the file. So the "weird" non-NeXus attributes
(such as `NX_class`) are really just the Concept Assertions.
For comparison, an XML infoset has built-in support for Concept
Assertions: the element's (qualified-)name. That said, asserting
multiple Concept Assertions for the same XML element is difficult in
XML, and (in general) requires either XML attributes or XML sub-elements.
Perhaps an interesting comparison is JSON, which (like HDF5) has no
inherent way of storing Concept Assertion information. JSON-LD is a
subset of JSON that encodes RDF (and so DL). In JSON-LD, the lack of
Concept Assertion in JSON is solved by assigning a special meaning to
the key "@type".
Here is some information that conforms to the schema.org class
http://schema.org/Person
{
"@context": {
"name": "http://schema.org/name",
"Person": "http://schema.org/Person"
},
"@id": "#paulmillar",
"@type": "Person",
"name": "Paul Millar"
}
To me, this `@type` key (in JSON-LD) looks rather similar to the
`NX_class` attribute in NeXus' HDF5 profile. The `@type` key is not
defined in schema.org for a similar reason why `NX_class` is not defined
in NXDL: it's a Concept Assertion, not a Rule Assertion.
An interestingly counter example is the NeXus application profile. This
*is* defined in NXentry (and NXsubentry) as the field `definition`, with
the `NXsubentry` NXDL definition also identifying the field
`definition_local`.
These two fields `definition` and `definition_local` look (to me) like
Concept Assertions, but are defined explicitly (in the corresponding
NXDL files) as if they were Role Assertions.
In this respect, the inclusion of `definition` and `definition_local` in
NXentry and Nxsubentry looks odd. I don't know the history why it was
done that way, rather than being defined in the NeXus HDF5 profile (like
`NX_class`).
Anyhow, apologies if a DL perspective isn't helpful.
HTH,
Paul.
More information about the NeXus
mailing list