Skip to content

DDI-CDI 1.1 (experimental)

Experimental

The cdi11 flavor follows DDI-CDI 1.1, which is a beta and not final. ddigraph never detects it: you must name it. Its labels and relationships may change in any release, as the standard changes.

The cdi11 flavor reads a DDI-CDI 1.1 XML file: a Wrapper or DDICDIModels root that holds the objects, as the bundled schema writes them (schemas/ddi-cdi-1.1/xml-schema/ddi-cdi.xsd). It reads a file the way the cdi flavor reads DDI-CDI 1.0, with the same code. An object with a ddiIdentifier is a DDI URN. An object with another identifier is scoped to the dataset. Each association, such as Code_denotes_Category, is a relationship.

Why you must name it

DDI-CDI 1.1 keeps the XML namespace of 1.0. So a 1.1 file looks like a 1.0 file, and ddigraph reads it as cdi unless you say otherwise. A file that uses a class only 1.1 has, such as LogicalRecordRepository, then fails: 1.0 has no such class. Name the flavor with --format cdi11 on load, and with --flavor cdi11 on validate, store add and shapes. In Python, pass flavor="cdi11".

Load and validate a file

ddigraph validate study.xml --flavor cdi11
ddigraph load study.xml --format cdi11 --dry-run
ddigraph load study.xml --format cdi11

validate checks the file against the bundled DDI-CDI 1.1 schema. The beta schema leaves three element types undefined, so no XSD tool can read it as it is. ddigraph accepts any content for those three elements, in memory only. --dry-run reads the file and counts what it would write, and writes nothing.

import ddigraph

for chunk in ddigraph.ir.parse("study.xml", flavor="cdi11"):
    print(len(chunk.nodes), len(chunk.relationships))

How the graph differs from cdi

  • A class that 1.0 labels keeps its label in 1.1, with the same properties. So a node that a cdi dataset and a cdi11 dataset both hold owns the same properties in each.
  • Such a node keeps a label for each flavor. When one of the two objects is a 1.0 DataStore or PhysicalRecordSegment, or a 1.1 LogicalRecordRepository or Segment, and the other is of a class both versions label, the second write stops with an error. The first dataset still reads as it was.
  • 1.1 drops DataStore and PhysicalRecordSegment. The classes that take their places, LogicalRecordRepository and Segment, get the labels CDILogicalRecordRepository and CDISegment.
  • Any other class new in 1.1, such as StatisticsCollection, is a CDIGenericEntity, with its class in entity_type.
  • The relationship types are named as for cdi. Two are new: HAS_SEGMENT (a physical data set has a segment) and HAS_WEIGHT (a weight variable). APPLIES_TO and HAS_PHYSICAL_RECORD_SEGMENT are gone, since 1.1 has no association they stand for.
  • In RDF, a node carries its DDI-CDI class, as for cdi. The two new labels take theirs from the 1.1 ontology, which keeps the 1.0 namespace: a CDISegment is a cdi:Segment.
  • The cdi11 labels add no index to Neo4j. The cdi indexes cover the labels both flavors share; CDILogicalRecordRepository and CDISegment have none.