← Back to demo

Manufacturing-X Round-Trip Query

store.dump('application/ld+json', 'urn:graph:mfgx-aas') serialises the entire named graph as expanded JSON-LD — every triple loaded from mfgx-aas.ttl comes back out. The 12 expected values are then located in the node array by AAS idShort and asserted against the original AAS inspection document.

1. What the round-trip verifies

Node B loads the AAS-ontology RDF (mfgx-aas.ttl, produced by py-aas-rdf) into urn:graph:mfgx-aas. The round-trip uses store.dump() (not a SPARQL query) to export the entire named graph as expanded JSON-LD. The result is a flat array of RDF node objects — one per subject IRI — rather than the original nested AAS hierarchy, but the data is semantically equivalent.

The original AAS JSON has no @context and is not valid JSON-LD, so it cannot be loaded back into Oxigraph for a direct graph diff. Instead, 12 known Property values are located in the dump by idShort and asserted against ground truth from inspectiondocument_316_4401_alloy.json.

2. How the dump works

Oxigraph WASM includes a built-in JSON-LD serialiser. The call is a single JS expression — no SPARQL involved:

// Dump urn:graph:mfgx-aas as expanded JSON-LD
const jsonLdStr = store.dump({
  format: 'application/ld+json',
  from_graph_name: namedNode('urn:graph:mfgx-aas')
});
const nodes = JSON.parse(jsonLdStr);
// nodes is an array of expanded JSON-LD node objects, e.g.:
// [{ "@id": "urn:...", "https://admin-shell.io/aas/3/0/Referable/idShort": [{"@value":"TensileStrengthMean"}], ... }, ...]

Each node corresponds to one RDF subject. Properties are keyed by their full IRI (expanded form), and values are wrapped in {"@value": "..."} objects. The total node count equals the number of distinct subjects in the graph.

To find a value by idShort:

const AAS_PROP_VAL = 'https://admin-shell.io/aas/3/0/Property/value';

// py-aas-rdf encodes idShort in the subject IRI — not as a separate triple.
// IRIs look like: …submodel-elements/MechanicalTests.TensileTest__00__.TensileStrengthMean
function findByIdShort(nodes, idShort) {
  const node = nodes.find(n => {
    const id = n['@id'] ?? '';
    return id.endsWith('.' + idShort) || id.endsWith('/' + idShort);
  });
  return node ? Number(node[AAS_PROP_VAL]?.[0]?.['@value']) : null;
}

3. Expected result

The dump returns all nodes in the graph. The 12 values located by idShort:

SectionKeyValue
mechanicalTestsTensileStrengthMean632
mechanicalTestsYieldOrProofStrengthMean276
mechanicalTestsElongationAfterFractureMean60
chemicalAnalysisMassFraction_C0.022
chemicalAnalysisMassFraction_Cr16.9
chemicalAnalysisMassFraction_Mn1.51
chemicalAnalysisMassFraction_Mo2.01
chemicalAnalysisMassFraction_N0.024
chemicalAnalysisMassFraction_Ni10
chemicalAnalysisMassFraction_P0.036
chemicalAnalysisMassFraction_S0.002
chemicalAnalysisMassFraction_Si0.4