Guide 4 — The semantic layer#
This guide examines the JSON-LD that BattINFO produces, explains how it connects to EMMO, and shows how to work with it using RDF tools.
Estimated time: 20 minutes Prerequisites: Guide 2 or Guide 3
New words? The plain-language glossary decodes EMMO, IRI, JSON-LD, and the rest in two sentences each.
[1]:
import json
import warnings
from pathlib import Path
SCRATCH = Path("_scratch/guide-04")
SCRATCH.mkdir(parents=True, exist_ok=True)
from battinfo import CellSpec, publish
from battinfo.api import publish_record
cell_spec = CellSpec(
manufacturer="A123 Systems",
model="ANR26650M1-B",
format="cylindrical",
chemistry="Li-ion",
positive_electrode_basis="LFP",
negative_electrode_basis="graphite",
size_code="R26650",
properties={
"nominal_capacity": {"value": 2.5, "unit": "Ah"},
"nominal_voltage": {"value": 3.3, "unit": "V"},
"rated_energy": {"value": 8.25, "unit": "Wh"},
"mass": {"value": 76.0, "unit": "g"},
"diameter": {"value": 26.0, "unit": "mm"},
"height": {"value": 65.0, "unit": "mm"},
"internal_resistance":{"value": 6.0, "unit": "mΩ"},
"cycle_life": {"value_text": ">1000", "unit": "count"},
},
)
result = publish(cell_spec, destination="local", root=SCRATCH)
output = publish_record(
result.debug_paths["canonical_record_path"],
target_root=SCRATCH / "resolver",
)
jsonld_path = Path(output["output_dir"], "index.jsonld")
jsonld = json.loads(jsonld_path.read_text(encoding="utf-8"))
print("Ready. IRI:", result.canonical_iri)
<repo>\src\battinfo\transform\cell_spec_node.py:483: UserWarning: semantic.value_text_only: 'cycle_life' on https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd carries only value_text - the JSON-LD export emits no numeric quantity value for it.
property_nodes = cell_spec_property_nodes(
<repo>\src\battinfo\transform\cell_spec_node.py:483: UserWarning: semantic.value_text_only: 'cycle_life' on https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd carries only value_text - the JSON-LD export emits no numeric quantity value for it.
property_nodes = cell_spec_property_nodes(
<repo>\src\battinfo\transform\cell_spec_node.py:483: UserWarning: semantic.value_text_only: 'cycle_life' on https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd carries only value_text - the JSON-LD export emits no numeric quantity value for it.
property_nodes = cell_spec_property_nodes(
<repo>\src\battinfo\transform\cell_spec_node.py:483: UserWarning: semantic.value_text_only: 'cycle_life' on https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd carries only value_text - the JSON-LD export emits no numeric quantity value for it.
property_nodes = cell_spec_property_nodes(
Ready. IRI: https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd
The full resolver JSON-LD#
[2]:
print(json.dumps(jsonld, indent=2))
{
"@context": [
"https://w3id.org/emmo/domain/battery/context",
{
"schema": "https://schema.org/",
"csvw": "http://www.w3.org/ns/csvw#",
"battinfo": "https://w3id.org/battinfo/",
"skos": "http://www.w3.org/2004/02/skos/core#"
}
],
"@type": [
"BatteryCellSpecification",
"schema:CreativeWork"
],
"@id": "https://w3id.org/battinfo/spec/wckm-y5a4-he0k-2scd",
"schema:identifier": "wckm-y5a4-he0k-2scd",
"schema:name": "A123 Systems ANR26650M1-B",
"schema:model": "ANR26650M1-B",
"schema:manufacturer": {
"@type": "schema:Organization",
"schema:name": "A123 Systems"
},
"schema:url": "https://www.battery-genome.org/registry/spec/wckm-y5a4-he0k-2scd",
"isDescriptionFor": {
"@type": [
"BatteryCell",
"CylindricalBattery",
"LithiumIonBattery",
"LithiumIonIronPhosphateBattery",
"LithiumIonGraphiteBattery"
],
"skos:prefLabel": "A123 Systems ANR26650M1-B"
},
"schema:size": "R26650",
"schema:schemaVersion": "0.2.0",
"hasProperty": [
{
"@type": [
"NominalCapacity",
"ConventionalProperty"
],
"skos:prefLabel": "NominalCapacity",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 2.5
},
"hasMeasurementUnit": "https://w3id.org/emmo#AmpereHour"
},
{
"@type": [
"NominalVoltage",
"ConventionalProperty"
],
"skos:prefLabel": "NominalVoltage",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 3.3
},
"hasMeasurementUnit": "https://w3id.org/emmo#Volt"
},
{
"@type": [
"NominalEnergy",
"ConventionalProperty"
],
"skos:prefLabel": "NominalEnergy",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 8.25
},
"hasMeasurementUnit": "https://w3id.org/emmo#Watthour"
},
{
"@type": [
"Mass",
"ConventionalProperty"
],
"skos:prefLabel": "Mass",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 76.0
},
"hasMeasurementUnit": "https://w3id.org/emmo#Gram"
},
{
"@type": [
"Diameter",
"ConventionalProperty"
],
"skos:prefLabel": "Diameter",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 26.0
},
"hasMeasurementUnit": "https://w3id.org/emmo#MilliMetre"
},
{
"@type": [
"Height",
"ConventionalProperty"
],
"skos:prefLabel": "Height",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 65.0
},
"hasMeasurementUnit": "https://w3id.org/emmo#MilliMetre"
},
{
"@type": [
"InternalResistance",
"ConventionalProperty"
],
"skos:prefLabel": "InternalResistance",
"hasNumericalPart": {
"@type": "RealData",
"hasNumberValue": 6.0
},
"hasMeasurementUnit": "https://w3id.org/emmo#MilliOhm"
},
{
"@type": [
"CycleLife",
"ConventionalProperty"
],
"skos:prefLabel": "CycleLife",
"schema:value": ">1000",
"hasMeasurementUnit": "https://w3id.org/emmo#EMMO_5ebd5e01_0ed3_49a2_a30d_cd05cbe72978"
}
],
"hasPositiveElectrode": {
"@type": "LithiumIronPhosphateElectrode"
},
"hasNegativeElectrode": {
"@type": "GraphiteElectrode"
},
"dcterms:source": {
"@type": "prov:Entity",
"dcterms:type": "datasheet",
"prov:generatedAtTime": "2026-08-04T01:23:12+00:00"
}
}
@context#
Maps short names to full IRIs. Every term — BatteryCell, hasNumericalPart, NominalCapacity — resolves to a UUID-based IRI in the EMMO domain-battery ontology. BattINFO bundles a local copy so processing works offline.
@id#
The permanent IRI for this cell spec, resolvable at https://w3id.org/battinfo/spec/{uid}.
@type stacking#
[3]:
print("@type classes:")
for t in jsonld["@type"]:
print(f" {t}")
@type classes:
BatteryCellSpecification
schema:CreativeWork
The specification node (BatteryCellSpecification) carries two types:
Vocabulary |
Type |
Rationale |
|---|---|---|
EMMO |
|
Information entity describing a class of cells |
schema.org |
|
The specification document as a creative artifact |
The physical EMMO classes derived from cell-spec fields are placed on an isDescriptionFor anonymous node:
Source field |
Physical EMMO class (on |
|---|---|
|
|
|
|
|
|
|
|
(always) |
|
Placing physical types on isDescriptionFor is semantically correct: the specification is an information entity, not a physical cell. The old pattern (putting BatteryCell directly on the specification @type) implied the specification IS a physical cell, which is wrong.
No manual annotation — derived entirely from plain-text field values.
hasProperty — the canonical EMMO quantity pattern#
isDescriptionFor — where physical EMMO types live#
The resolver JSON-LD above is a lightweight discovery document — it omits the physical type stacking to keep file size small. The full descriptor JSON-LD (produced by to_jsonld) includes an isDescriptionFor anonymous node that carries the physical EMMO classes:
This placement is semantically correct: the specification is an information entity, not a physical cell. Putting BatteryCell on the specification @type would assert the specification IS a physical cell — which is wrong.
hasDescription — the reverse link from cell instance to specification#
Cell instances (physical objects with serial numbers) carry hasDescription pointing to the specification IRI, plus schema:isVariantOf for schema.org alignment:
The directionality reflects how data is created: the cell spec is registered first and given a stable IRI; individual cells with serial numbers are created later and reference it. Both hasDescription (EMMO) and schema:isVariantOf (schema.org) express the same relationship in their respective vocabularies.
[4]:
# Show isDescriptionFor from the full descriptor pipeline
from battinfo.transform.json_to_jsonld import _descriptor_specification_to_jsonld
spec = {
"format": "cylindrical",
"chemistry": "Li-ion",
"positive_electrode_basis": "LFP",
"negative_electrode_basis": "graphite",
}
node = _descriptor_specification_to_jsonld(spec)
print("Specification @type:", node["@type"])
print("isDescriptionFor @type:", node["isDescriptionFor"]["@type"])
Specification @type: ['BatteryCellSpecification', 'schema:CreativeWork']
isDescriptionFor @type: ['BatteryCell', 'CylindricalBattery', 'LithiumIonBattery', 'LithiumIonIronPhosphateBattery', 'LithiumIonGraphiteBattery']
[5]:
print("Quantitative properties:")
for prop in jsonld.get("hasProperty", []):
types = prop["@type"]
class_name = types[0] if isinstance(types, list) else types
value = prop.get("hasNumericalPart", {}).get("hasNumberValue")
unit = prop.get("hasMeasurementUnit", "").split("#")[-1]
print(f" {class_name}: {value} ({unit})")
Quantitative properties:
NominalCapacity: 2.5 (AmpereHour)
NominalVoltage: 3.3 (Volt)
NominalEnergy: 8.25 (Watthour)
Mass: 76.0 (Gram)
Diameter: 26.0 (MilliMetre)
Height: 65.0 (MilliMetre)
InternalResistance: 6.0 (MilliOhm)
CycleLife: None (EMMO_5ebd5e01_0ed3_49a2_a30d_cd05cbe72978)
The pattern is:
hasProperty → NominalCapacity, ConventionalProperty
├── hasNumericalPart → RealData → hasNumericalValue: 2.5
└── hasMeasurementUnit: <EMMO AmpereHour IRI>
This is the canonical EMMO quantity pattern — identical across all EMMO domain modules.
Validating JSON-LD#
[6]:
from battinfo.validate.jsonld import validate_jsonld_report
report = validate_jsonld_report(jsonld)
print("ok:", report.ok)
for issue in report.issues:
print(f" [{issue.severity}] {issue.code}: {issue.message}")
ok: True
Check |
What fails |
|---|---|
|
Bare |
RDF parse |
JSON-LD rdflib cannot parse into a valid RDF dataset |
URDNA2015 |
JSON-LD that cannot be canonically normalised |
Loading into an RDF graph#
[7]:
from rdflib import Graph
g = Graph()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning, module="rdflib")
g.parse(str(jsonld_path), format="json-ld")
print(f"Triple count: {len(g)}")
Triple count: 88
[8]:
# All triples in the graph
for s, p, o in sorted(g):
s_l = str(s).split("/")[-1].split("#")[-1]
p_l = str(p).split("/")[-1].split("#")[-1]
o_l = str(o).split("/")[-1].split("#")[-1]
print(f" {s_l} → {p_l} → {o_l}")
N0379cdffbf56498b845455ef78356a80 → type → electrochemistry_c831d963_629a_41ab_850f_97fb6841b739
N051aff4ca3fd4b0f9b003e255976ac07 → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
N051aff4ca3fd4b0f9b003e255976ac07 → type → electrochemistry_8abde9d0_84f6_4b4f_a87e_86028a397100
N051aff4ca3fd4b0f9b003e255976ac07 → prefLabel → NominalCapacity
N051aff4ca3fd4b0f9b003e255976ac07 → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → N9c8620a4df5f4cdabafdfbc1feb23222
N051aff4ca3fd4b0f9b003e255976ac07 → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → AmpereHour
N195dca1978fa4907bb2454b411a6febe → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
N195dca1978fa4907bb2454b411a6febe → type → electrochemistry_19e27aa3_0970_43a6_86d3_e3cdd956134d
N195dca1978fa4907bb2454b411a6febe → prefLabel → NominalEnergy
N195dca1978fa4907bb2454b411a6febe → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → N497e106d520f4124a5978412fea2aa66
N195dca1978fa4907bb2454b411a6febe → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → Watthour
N19dc2630a90a41569cc5371906b9cc91 → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
N19dc2630a90a41569cc5371906b9cc91 → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 6.0
N1e78ca3bc69b4ba0bce274349ad42c94 → type → Organization
N1e78ca3bc69b4ba0bce274349ad42c94 → name → A123 Systems
N2d516272fe7f41cc8e3312ee57f9b37b → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
N2d516272fe7f41cc8e3312ee57f9b37b → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 26.0
N3bbf8bfe66ec4447845db91f37ebda0d → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
N3bbf8bfe66ec4447845db91f37ebda0d → type → electrochemistry_9bf40017_3f58_4030_ada7_cb37a3dfda2d
N3bbf8bfe66ec4447845db91f37ebda0d → prefLabel → InternalResistance
N3bbf8bfe66ec4447845db91f37ebda0d → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → N19dc2630a90a41569cc5371906b9cc91
N3bbf8bfe66ec4447845db91f37ebda0d → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → MilliOhm
N456f5accc3b54ea495f0f7a147b0095f → type → EMMO_c1c8ac3c_8a1c_4777_8e0b_14c1f9f9b0c6
N456f5accc3b54ea495f0f7a147b0095f → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
N456f5accc3b54ea495f0f7a147b0095f → prefLabel → Diameter
N456f5accc3b54ea495f0f7a147b0095f → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → N2d516272fe7f41cc8e3312ee57f9b37b
N456f5accc3b54ea495f0f7a147b0095f → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → MilliMetre
N497e106d520f4124a5978412fea2aa66 → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
N497e106d520f4124a5978412fea2aa66 → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 8.25
N55c9e5e50bb44587a486de33d95fa306 → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
N55c9e5e50bb44587a486de33d95fa306 → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 3.3
N5c481096881545b59361c4d27990dda3 → type → battery_04a4e5a4_e6fd_43af_b1ca_4a16d5f8886c
N5c481096881545b59361c4d27990dda3 → type → battery_2018e0da_4c25_46e9_83db_38431fc81ce0
N5c481096881545b59361c4d27990dda3 → type → battery_68ed592a_7924_45d0_a108_94d6275d57f0
N5c481096881545b59361c4d27990dda3 → type → battery_96addc62_ea04_449a_8237_4cd541dd8e5f
N5c481096881545b59361c4d27990dda3 → type → battery_ac604ecd_cc60_4b98_b57c_74cd5d3ccd40
N5c481096881545b59361c4d27990dda3 → prefLabel → A123 Systems ANR26650M1-B
N8778da101e33437a819722129256db43 → type → electrochemistry_1d0f15cb_d6b5_4c27_89ca_fe78adc1ce5b
N9c8620a4df5f4cdabafdfbc1feb23222 → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
N9c8620a4df5f4cdabafdfbc1feb23222 → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 2.5
Na77d40d4f9414abc871b674d57b5d363 → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
Na77d40d4f9414abc871b674d57b5d363 → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 65.0
Nb0b92f5cbfe94deb9b808486f2022a5a → type → EMMO_18d180e4_5e3e_42f7_820c_e08951223486
Nb0b92f5cbfe94deb9b808486f2022a5a → EMMO_faf79f53_749d_40b2_807c_d34244c192f4 → 76.0
Ncd6d4f59e150403da2498c816083db39 → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
Ncd6d4f59e150403da2498c816083db39 → type → electrochemistry_639b844a_e801_436b_985d_28926129ead6
Ncd6d4f59e150403da2498c816083db39 → prefLabel → NominalVoltage
Ncd6d4f59e150403da2498c816083db39 → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → N55c9e5e50bb44587a486de33d95fa306
Ncd6d4f59e150403da2498c816083db39 → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → Volt
Nddf9e8118187406bb18e2aec6b61f228 → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
Nddf9e8118187406bb18e2aec6b61f228 → type → electrochemistry_ae782b14_88ce_4cdd_9418_12aca00be937
Nddf9e8118187406bb18e2aec6b61f228 → prefLabel → CycleLife
Nddf9e8118187406bb18e2aec6b61f228 → value → >1000
Nddf9e8118187406bb18e2aec6b61f228 → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → EMMO_5ebd5e01_0ed3_49a2_a30d_cd05cbe72978
Ne1a2af9c01654dfdb6437dfc5b2c21cd → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
Ne1a2af9c01654dfdb6437dfc5b2c21cd → type → EMMO_ed4af7ae_63a2_497e_bb88_2309619ea405
Ne1a2af9c01654dfdb6437dfc5b2c21cd → prefLabel → Mass
Ne1a2af9c01654dfdb6437dfc5b2c21cd → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → Nb0b92f5cbfe94deb9b808486f2022a5a
Ne1a2af9c01654dfdb6437dfc5b2c21cd → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → Gram
Nf39dfa163c1c428f8e9a60116509bc8b → type → datasheet
Nf39dfa163c1c428f8e9a60116509bc8b → type → Entity
Nf39dfa163c1c428f8e9a60116509bc8b → generatedAtTime → 2026-08-04T01:23:12+00:00
Nfea1b7fb6b6b41c6b9064eea68ad52a4 → type → EMMO_08bcf1d6_e719_46c8_bb21_24bc9bf34dba
Nfea1b7fb6b6b41c6b9064eea68ad52a4 → type → EMMO_d8aa8e1f_b650_416d_88a0_5118de945456
Nfea1b7fb6b6b41c6b9064eea68ad52a4 → prefLabel → Height
Nfea1b7fb6b6b41c6b9064eea68ad52a4 → EMMO_8ef3cd6d_ae58_4a8d_9fc0_ad8f49015cd0 → Na77d40d4f9414abc871b674d57b5d363
Nfea1b7fb6b6b41c6b9064eea68ad52a4 → EMMO_bed1d005_b04e_4a90_94cf_02bc678a8569 → MilliMetre
wckm-y5a4-he0k-2scd → source → Nf39dfa163c1c428f8e9a60116509bc8b
wckm-y5a4-he0k-2scd → type → CreativeWork
wckm-y5a4-he0k-2scd → type → battery_1cfbba6c_8824_4932_a23e_2141483acef7
wckm-y5a4-he0k-2scd → identifier → wckm-y5a4-he0k-2scd
wckm-y5a4-he0k-2scd → manufacturer → N1e78ca3bc69b4ba0bce274349ad42c94
wckm-y5a4-he0k-2scd → model → ANR26650M1-B
wckm-y5a4-he0k-2scd → name → A123 Systems ANR26650M1-B
wckm-y5a4-he0k-2scd → schemaVersion → 0.2.0
wckm-y5a4-he0k-2scd → size → R26650
wckm-y5a4-he0k-2scd → url → wckm-y5a4-he0k-2scd
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → N051aff4ca3fd4b0f9b003e255976ac07
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → N195dca1978fa4907bb2454b411a6febe
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → N3bbf8bfe66ec4447845db91f37ebda0d
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → N456f5accc3b54ea495f0f7a147b0095f
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → Ncd6d4f59e150403da2498c816083db39
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → Nddf9e8118187406bb18e2aec6b61f228
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → Ne1a2af9c01654dfdb6437dfc5b2c21cd
wckm-y5a4-he0k-2scd → EMMO_e1097637_70d2_4895_973f_2396f04fa204 → Nfea1b7fb6b6b41c6b9064eea68ad52a4
wckm-y5a4-he0k-2scd → EMMO_f702bad4_fc77_41f0_a26d_79f6444fd4f3 → N5c481096881545b59361c4d27990dda3
wckm-y5a4-he0k-2scd → electrochemistry_5d299271_3f68_494f_ab96_3db9acdd3138 → N0379cdffbf56498b845455ef78356a80
wckm-y5a4-he0k-2scd → electrochemistry_8e9cf965_9f92_46e8_b678_b50410ce3616 → N8778da101e33437a819722129256db43
Combining multiple records in one graph#
[9]:
import battinfo
ws = battinfo.workspace(root=SCRATCH / "multi")
multi_spec = battinfo.CellSpec(
manufacturer="A123 Systems", model="ANR26650M1-B",
format="cylindrical", chemistry="Li-ion",
positive_electrode_basis="LFP", negative_electrode_basis="graphite",
properties={"nominal_capacity": {"value": 2.5, "unit": "Ah"}},
)
ws.add("cell", spec=multi_spec, serial_numbers=["a123-demo-multi-001"])
ws.save()
# Publish each saved record as a resolver artifact
from battinfo.api import publish_record as _publish_one
multi_records = SCRATCH / "multi" / ".battinfo" / "records" / "examples"
multi_resolver = SCRATCH / "multi-resolver"
for record_file in sorted(multi_records.rglob("*.json")):
_publish_one(record_file, target_root=multi_resolver)
jsonld_files = list(multi_resolver.rglob("index.jsonld"))
g2 = Graph()
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning, module="rdflib")
for jf in jsonld_files:
g2.parse(str(jf), format="json-ld")
print(f"Combined graph: {len(g2)} triples from {len(jsonld_files)} files")
cell: a123-demo-multi-001 (IRI auto-assigned)
Saved 2 record(s) under <repo>\docs\guides\_scratch\guide-04\multi\.battinfo\records:
cell spec A123 Systems ANR26650M1-B [created] .battinfo\records\cell-spec\cell-spec-e4t5-w9re-mpq6-8g7e.json
cell a123-demo-multi-001 [created] .battinfo\records\cell-instance\cell-aaqe-rvbd-c0b6-p1k3.json
Next: ws.list(verbose=True) to inspect, or ws.publish() to publish.
Combined graph: 0 triples from 0 files
Mapping tables#
BattINFO’s semantic output is driven by three curated files:
File |
Role |
|---|---|
|
JSON key → EMMO class IRI |
|
Unit string → EMMO/QUDT IRI |
|
format/chemistry/electrode → @type array |
[10]:
prop_map = json.loads(
# Repo files sit two levels up from this notebook.
Path("../../assets/mappings/domain-battery/property_map.curated.json").read_text(encoding="utf-8")
)
print(f"Property map version: {prop_map['version']}")
print(f"Curated entries: {len(prop_map['mappings'])}")
print()
for entry in prop_map["mappings"][:8]:
print(f" {entry['key']:42s} → {entry['class_pref_label']}")
print(" ...")
Property map version: 0.4.0
Curated entries: 71
ac_internal_resistance → ACInternalResistance
available_volume → Volume
calendar_life → CalendarLife
cap_assembly_weight → Mass
capacity_fade → CapacityFade
certified_usable_energy → NominalEnergy
charging_cutoff_voltage → UpperVoltageLimit
charging_temperature_max → MaximumChargingTemperature
...
Next#
Guide 5 — Descriptors: author research-grade cell descriptors and see richer electrode-level JSON-LD