lineage-data-format 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
ldf/__init__.py ADDED
@@ -0,0 +1,24 @@
1
+ """
2
+ Lineage Definition Format (LDF) - Token-optimized graph serialization.
3
+
4
+ This library provides functions to convert between JSON lineage data
5
+ and a compact lineage definition format.
6
+ """
7
+
8
+ from .converter import (
9
+ json_to_lineage_format,
10
+ lineage_format_to_json,
11
+ convert_json_file_to_lineage,
12
+ convert_lineage_file_to_json,
13
+ )
14
+
15
+ __version__ = "0.1.0"
16
+
17
+ __all__ = [
18
+ "json_to_lineage_format",
19
+ "lineage_format_to_json",
20
+ "convert_json_file_to_lineage",
21
+ "convert_lineage_file_to_json",
22
+ ]
23
+
24
+ # Made with Bob
ldf/cli.py ADDED
@@ -0,0 +1,95 @@
1
+ """
2
+ Command-line interface for lineage data format converter.
3
+ """
4
+
5
+ import argparse
6
+ import sys
7
+ from pathlib import Path
8
+ from .converter import (
9
+ convert_json_file_to_lineage,
10
+ convert_lineage_file_to_json,
11
+ )
12
+
13
+
14
+ def main():
15
+ """Main CLI entry point."""
16
+ parser = argparse.ArgumentParser(
17
+ description="Convert between JSON and Lineage Definition Format",
18
+ formatter_class=argparse.RawDescriptionHelpFormatter,
19
+ epilog="""
20
+ Examples:
21
+ # Convert JSON to lineage format
22
+ ldf json-to-lineage input.json output.ldf
23
+
24
+ # Convert lineage format to JSON
25
+ ldf lineage-to-json input.ldf output.json
26
+
27
+ # Use compact format (no extra whitespace)
28
+ ldf json-to-lineage input.json output.ldf --compact
29
+ """
30
+ )
31
+
32
+ subparsers = parser.add_subparsers(dest='command', help='Command to execute')
33
+
34
+ # json-to-lineage command
35
+ json_parser = subparsers.add_parser(
36
+ 'json-to-lineage',
37
+ help='Convert JSON file to lineage format'
38
+ )
39
+ json_parser.add_argument('input', help='Input JSON file path')
40
+ json_parser.add_argument('output', help='Output lineage format file path')
41
+ json_parser.add_argument(
42
+ '--compact',
43
+ action='store_true',
44
+ help='Use compact format (no extra whitespace)'
45
+ )
46
+
47
+ # lineage-to-json command
48
+ lineage_parser = subparsers.add_parser(
49
+ 'lineage-to-json',
50
+ help='Convert lineage format file to JSON'
51
+ )
52
+ lineage_parser.add_argument('input', help='Input lineage format file path')
53
+ lineage_parser.add_argument('output', help='Output JSON file path')
54
+ lineage_parser.add_argument(
55
+ '--indent',
56
+ type=int,
57
+ default=2,
58
+ help='JSON indentation level (default: 2)'
59
+ )
60
+
61
+ args = parser.parse_args()
62
+
63
+ if not args.command:
64
+ parser.print_help()
65
+ sys.exit(1)
66
+
67
+ try:
68
+ if args.command == 'json-to-lineage':
69
+ convert_json_file_to_lineage(
70
+ args.input,
71
+ args.output,
72
+ compact=args.compact
73
+ )
74
+ print(f"✓ Converted {args.input} → {args.output}")
75
+
76
+ elif args.command == 'lineage-to-json':
77
+ convert_lineage_file_to_json(
78
+ args.input,
79
+ args.output,
80
+ indent=args.indent
81
+ )
82
+ print(f"✓ Converted {args.input} → {args.output}")
83
+
84
+ except FileNotFoundError as e:
85
+ print(f"Error: File not found - {e}", file=sys.stderr)
86
+ sys.exit(1)
87
+ except Exception as e:
88
+ print(f"Error: {e}", file=sys.stderr)
89
+ sys.exit(1)
90
+
91
+
92
+ if __name__ == '__main__':
93
+ main()
94
+
95
+ # Made with Bob
ldf/converter.py ADDED
@@ -0,0 +1,718 @@
1
+ """
2
+ Converter module for lineage data format.
3
+ Provides functions to convert between JSON and lineage format.
4
+ """
5
+
6
+ import json
7
+ from typing import Dict, List, Any, Optional, Tuple
8
+
9
+
10
+ def json_to_lineage_format(graph: Dict[str, Any], options: Optional[Dict[str, bool]] = None) -> str:
11
+ """
12
+ Convert a backend LineageGraph dict to lineage format string.
13
+
14
+ Args:
15
+ graph: Dictionary in backend LineageGraph format with keys:
16
+ - assets_in_view: List of asset dicts (LineageAsset)
17
+ - edges_in_view: List of edge dicts (FlowEdge)
18
+ - graph_calculation_datetime: ISO datetime string (optional)
19
+ - graph_calculation_timestamp: Unix timestamp (optional)
20
+ options: Optional dict with 'compact' boolean flag
21
+
22
+ Returns:
23
+ String in lineage format
24
+ """
25
+ compact = options.get("compact", False) if options else False
26
+ # In compact mode: no blank lines between sections, but entries still
27
+ # use newlines so the line-based parser can read them back correctly.
28
+ nl = "\n"
29
+ section_break = "\n" if compact else "\n\n"
30
+
31
+ assets: List[Dict[str, Any]] = graph.get("assets_in_view", [])
32
+ edges_raw: List[Dict[str, Any]] = graph.get("edges_in_view", [])
33
+ dt = graph.get("graph_calculation_datetime")
34
+ ts = graph.get("graph_calculation_timestamp")
35
+
36
+ # ------------------------------------------------------------------ helpers
37
+
38
+ def pct_encode(s: str) -> str:
39
+ """Percent-encode characters that are structural in LDF tokens.
40
+ Handles all characters that would break inline parsing:
41
+ % → %25 (must be first to avoid double-encoding)
42
+ \n → %0A (breaks line-based section parsing)
43
+ \r → %0D (normalised away but encode for safety)
44
+ space → %20 (breaks space-delimited N: token parsing)
45
+ , → %2C (breaks comma-delimited array parsing in tags/bt/bc/dc)
46
+ [ → %5B (structural in array notation)
47
+ ] → %5D (structural in array notation)
48
+ | → %7C (section-level field separator)
49
+ = → %3D (key=value separator)
50
+ """
51
+ s = s.replace("%", "%25")
52
+ s = s.replace("\r", "%0D")
53
+ s = s.replace("\n", "%0A")
54
+ s = s.replace(" ", "%20")
55
+ s = s.replace(",", "%2C")
56
+ s = s.replace("[", "%5B")
57
+ s = s.replace("]", "%5D")
58
+ s = s.replace("|", "%7C")
59
+ s = s.replace("=", "%3D")
60
+ return s
61
+
62
+ def encode_array(arr: Optional[List[Any]]) -> str:
63
+ if arr:
64
+ return f"[{','.join(str(x) for x in arr)}]"
65
+ return "[]"
66
+
67
+ def dict_section(name: str, dict_data: Optional[Dict[str, str]]) -> str:
68
+ if not dict_data:
69
+ return ""
70
+ entries = [f"{k}={v}" for k, v in dict_data.items()]
71
+ return name + ":" + nl + nl.join(entries)
72
+
73
+ def kv_section(name: str, entries: Dict[str, str]) -> str:
74
+ """Generic per-node section: NAME:\nN1=value\n..."""
75
+ if not entries:
76
+ return ""
77
+ lines = [f"{k}={v}" for k, v in entries.items()]
78
+ return name + ":" + nl + nl.join(lines)
79
+
80
+ # ------------------------------------------------------------------ alias maps
81
+
82
+ # Node alias: asset.id -> N1, N2, ...
83
+ alias_map: Dict[str, str] = {}
84
+ for i, asset in enumerate(assets):
85
+ alias_map[asset["id"]] = f"N{i + 1}"
86
+
87
+ # Technology lookup (deduplicate by id, fallback to name when id absent)
88
+ t_dict: Dict[str, str] = {} # T1 -> name
89
+ tid_dict: Dict[str, str] = {} # T1 -> id
90
+ _tech_id_to_key: Dict[str, str] = {} # tech id -> T-alias
91
+ _tech_name_to_key: Dict[str, str] = {} # tech name -> T-alias (fallback)
92
+ _tech_idx = 1
93
+
94
+ def get_tech_key(tech: Dict[str, Any]) -> str:
95
+ nonlocal _tech_idx
96
+ tech_id = tech.get("id", "")
97
+ name = tech.get("name", "")
98
+ # Prefer deduplication by id; fall back to name when id is absent
99
+ dedup_key = tech_id if tech_id else name
100
+ dedup_store = _tech_id_to_key if tech_id else _tech_name_to_key
101
+ if dedup_key not in dedup_store:
102
+ key = f"T{_tech_idx}"
103
+ _tech_idx += 1
104
+ dedup_store[dedup_key] = key
105
+ t_dict[key] = name
106
+ if tech_id:
107
+ tid_dict[key] = tech_id
108
+ return dedup_store[dedup_key]
109
+
110
+ # BT / BC / DC lookups (deduplicate by id|name)
111
+ bt_dict: Dict[str, str] = {}
112
+ bc_dict: Dict[str, str] = {}
113
+ dc_dict: Dict[str, str] = {}
114
+ _bt_idx = _bc_idx = _dc_idx = 1
115
+
116
+ def get_lookup_key(
117
+ store: Dict[str, str],
118
+ idx_ref: List[int],
119
+ prefix: str,
120
+ item_id: str,
121
+ item_name: str,
122
+ ) -> str:
123
+ combined = f"{item_id}|{item_name}"
124
+ for k, v in store.items():
125
+ if v == combined:
126
+ return k
127
+ key = f"{prefix}{idx_ref[0]}"
128
+ idx_ref[0] += 1
129
+ store[key] = combined
130
+ return key
131
+
132
+ bt_idx_ref = [1]
133
+ bc_idx_ref = [1]
134
+ dc_idx_ref = [1]
135
+
136
+ # ID and NAME lookups
137
+ id_dict: Dict[str, str] = {}
138
+ name_dict: Dict[str, str] = {}
139
+
140
+ # Per-node section dicts
141
+ hp_entries: Dict[str, str] = {}
142
+ attr_entries: Dict[str, str] = {}
143
+ scs_entries: Dict[str, str] = {}
144
+ ca_entries: Dict[str, str] = {}
145
+ pa_entries: Dict[str, str] = {}
146
+ sa_entries: Dict[str, str] = {}
147
+ dsd_entries: Dict[str, str] = {}
148
+
149
+ # ------------------------------------------------------------------ node lines
150
+
151
+ node_lines: List[str] = []
152
+
153
+ for asset in assets:
154
+ asset_id = asset["id"]
155
+ alias = alias_map[asset_id]
156
+
157
+ id_dict[alias] = asset_id
158
+ # pct_encode preserves \n and other structural chars in the name value
159
+ # so the line-based NAME: section parser doesn't split mid-value.
160
+ name_dict[alias] = pct_encode(asset.get("name", ""))
161
+
162
+ # --- technology path alias
163
+ tech = asset.get("technology")
164
+ tech_alias = get_tech_key(tech) if tech else ""
165
+
166
+ # --- BT aliases
167
+ bt_aliases: List[str] = []
168
+ for term in asset.get("business_terms") or []:
169
+ k = get_lookup_key(bt_dict, bt_idx_ref, "BT", term["id"], term.get("name", ""))
170
+ bt_aliases.append(k)
171
+
172
+ # --- BC aliases
173
+ bc_aliases: List[str] = []
174
+ for cls in asset.get("business_classifications") or []:
175
+ k = get_lookup_key(bc_dict, bc_idx_ref, "BC", cls["id"], cls.get("name", ""))
176
+ bc_aliases.append(k)
177
+
178
+ # --- DC aliases
179
+ dc_aliases: List[str] = []
180
+ for dc in asset.get("data_classes") or []:
181
+ k = get_lookup_key(dc_dict, dc_idx_ref, "DC", dc["id"], dc.get("name", ""))
182
+ dc_aliases.append(k)
183
+
184
+ # --- flags bitmask
185
+ flags = (
186
+ (1 if asset.get("is_deduced") else 0)
187
+ | (2 if asset.get("is_transforming") else 0)
188
+ | (4 if asset.get("is_operational") else 0)
189
+ | (8 if asset.get("is_temporary") else 0)
190
+ | (16 if asset.get("is_favorite") else 0)
191
+ )
192
+
193
+ # --- children
194
+ children = asset.get("children")
195
+
196
+ # --- build N: line parts
197
+ # rk, origin, ik and type are percent-encoded so spaces (and structural
198
+ # chars) don't break the space-delimited inline token format.
199
+ # Tags are individually percent-encoded so commas/spaces/brackets inside
200
+ # a tag value don't corrupt the comma-delimited array.
201
+ node_type = pct_encode(asset.get("type", ""))
202
+ parts: List[str] = [f"{alias}:{node_type}"]
203
+ if asset.get("resource_key"):
204
+ parts.append(f"rk={pct_encode(asset['resource_key'])}")
205
+ if asset.get("origin"):
206
+ parts.append(f"origin={pct_encode(asset['origin'])}")
207
+ if asset.get("identity_key"):
208
+ parts.append(f"ik={pct_encode(asset['identity_key'])}")
209
+ if tech_alias:
210
+ parts.append(f"path={tech_alias}")
211
+ tags = asset.get("tags") or []
212
+ if tags:
213
+ parts.append(f"tags={encode_array([pct_encode(tag) for tag in tags])}")
214
+ if bt_aliases:
215
+ parts.append(f"bt={encode_array(bt_aliases)}")
216
+ if bc_aliases:
217
+ parts.append(f"bc={encode_array(bc_aliases)}")
218
+ if dc_aliases:
219
+ parts.append(f"dc={encode_array(dc_aliases)}")
220
+ if flags:
221
+ parts.append(f"flags={flags}")
222
+ if children is not None:
223
+ count = children.get("count", 0)
224
+ has_any = 1 if children.get("has_any") else 0
225
+ href = children.get("href", "")
226
+ # Use comma as separator: ch=count,has_any,href
227
+ # (href may contain colons from URLs, comma never appears in count/has_any/href)
228
+ ch_str = f"ch={count},{has_any},{href}" if href else f"ch={count},{has_any}"
229
+ parts.append(ch_str)
230
+
231
+ node_lines.append(" ".join(parts))
232
+
233
+ # --- HP section
234
+ # Format: "id:name:type|id:name:type".
235
+ # id is always hex/UUID → never contains ":" or "|".
236
+ # name and type CAN contain ":" and "|", so both are percent-encoded
237
+ # ("%3A" for ":", "%7C" for "|", "%25" for "%").
238
+ # This makes the three-field split unambiguous on parse.
239
+ hp_items = asset.get("hierarchical_path") or []
240
+ if hp_items:
241
+ def _encode_hp_field(s: str) -> str:
242
+ # Full structural encoding via pct_encode, then also encode ":"
243
+ # which pct_encode leaves alone (it's only structural in HP segments).
244
+ s = pct_encode(s)
245
+ s = s.replace(":", "%3A")
246
+ return s
247
+ def _encode_hp_segment(h: Dict[str, Any]) -> str:
248
+ return (f"{h['id']}:{_encode_hp_field(h.get('name',''))}"
249
+ f":{_encode_hp_field(h.get('type',''))}")
250
+ hp_entries[alias] = "|".join(_encode_hp_segment(h) for h in hp_items)
251
+
252
+ # --- ATTR section
253
+ # Format: "name=value|name=value". The separator between attr entries
254
+ # is "|". Within each entry "=" separates name from value.
255
+ # "name" is always a system identifier (no "=" in it).
256
+ # "value" may contain ":" so we cannot use ":" as separator here.
257
+ # "value" may contain "|" so we percent-encode "|" and "%" in values.
258
+ attr_items = asset.get("attributes") or []
259
+ if attr_items:
260
+ attr_entries[alias] = "|".join(
261
+ f"{a['name']}={pct_encode(a['value'])}" for a in attr_items
262
+ )
263
+
264
+ # --- SCS / CA / PA / SA sections (JSON blobs)
265
+ scs = asset.get("source_code_snippets")
266
+ if scs:
267
+ scs_entries[alias] = json.dumps(scs, ensure_ascii=False).replace("\n", " ")
268
+
269
+ ca = asset.get("catalog_assignments")
270
+ if ca:
271
+ ca_entries[alias] = json.dumps(ca, ensure_ascii=False).replace("\n", " ")
272
+
273
+ pa = asset.get("project_assignments")
274
+ if pa:
275
+ pa_entries[alias] = json.dumps(pa, ensure_ascii=False).replace("\n", " ")
276
+
277
+ sa = asset.get("space_assignments")
278
+ if sa:
279
+ sa_entries[alias] = json.dumps(sa, ensure_ascii=False).replace("\n", " ")
280
+
281
+ # --- DSD section
282
+ dsd = asset.get("data_source_definition_asset")
283
+ if dsd:
284
+ dsd_entries[alias] = f"{dsd['id']}:{pct_encode(dsd.get('name', ''))}"
285
+
286
+ # ------------------------------------------------------------------ GRAPH section
287
+
288
+ # First line is a stable marker; dt= and ts= carry the actual values.
289
+ graph_lines = ["lineage_graph"]
290
+ if dt:
291
+ graph_lines.append(f"dt={dt}")
292
+ if ts is not None:
293
+ graph_lines.append(f"ts={ts}")
294
+ GRAPH = "GRAPH:" + nl + nl.join(graph_lines)
295
+
296
+ # ------------------------------------------------------------------ START section
297
+
298
+ start_alias = alias_map[assets[0]["id"]] if assets else "N1"
299
+ START = f"START:{nl}{start_alias}"
300
+
301
+ # ------------------------------------------------------------------ E / EP sections
302
+
303
+ edge_lines: List[str] = []
304
+ ep_lines: List[str] = []
305
+
306
+ for edge in edges_raw:
307
+ src_alias = alias_map.get(edge.get("source", ""), edge.get("source", ""))
308
+ tgt_alias = alias_map.get(edge.get("target", ""), edge.get("target", ""))
309
+ edge_lines.append(f"{src_alias}>{tgt_alias}")
310
+ if edge.get("type"):
311
+ ep_lines.append(f"{src_alias}>{tgt_alias} etype={edge['type']}")
312
+
313
+ E = "E:" + nl + nl.join(edge_lines) if edge_lines else ""
314
+ EP = "EP:" + nl + nl.join(ep_lines) if ep_lines else ""
315
+
316
+ # ------------------------------------------------------------------ N section
317
+
318
+ N = "N:" + nl + nl.join(node_lines)
319
+
320
+ # ------------------------------------------------------------------ assemble
321
+
322
+ sections = [
323
+ GRAPH,
324
+ START,
325
+ E,
326
+ EP,
327
+ N,
328
+ dict_section("T", t_dict),
329
+ dict_section("TID", tid_dict),
330
+ dict_section("ID", id_dict),
331
+ dict_section("NAME", name_dict),
332
+ dict_section("BT", bt_dict),
333
+ dict_section("BC", bc_dict),
334
+ dict_section("DC", dc_dict),
335
+ kv_section("HP", hp_entries),
336
+ kv_section("ATTR", attr_entries),
337
+ kv_section("SCS", scs_entries),
338
+ kv_section("CA", ca_entries),
339
+ kv_section("PA", pa_entries),
340
+ kv_section("SA", sa_entries),
341
+ kv_section("DSD", dsd_entries),
342
+ ]
343
+
344
+ return section_break.join(s for s in sections if s)
345
+
346
+
347
+ def lineage_format_to_json(input_text: str) -> Dict[str, Any]:
348
+ """
349
+ Convert lineage format string back to the backend LineageGraph JSON schema.
350
+
351
+ Args:
352
+ input_text: String in lineage format
353
+
354
+ Returns:
355
+ Dictionary matching the backend LineageGraph schema:
356
+ - assets_in_view: list of LineageAsset dicts
357
+ - edges_in_view: list of FlowEdge dicts
358
+ - graph_calculation_datetime: ISO datetime string (optional)
359
+ - graph_calculation_timestamp: Unix timestamp int (optional)
360
+ """
361
+ normalized = input_text.replace('\r', '').strip()
362
+ lines = normalized.split('\n')
363
+
364
+ sections: Dict[str, List[str]] = {}
365
+ current = ""
366
+
367
+ for line in lines:
368
+ trimmed = line.strip()
369
+ if not trimmed:
370
+ continue
371
+ # Section header: all-uppercase word followed by colon
372
+ if trimmed.endswith(':') and trimmed[:-1].replace('_', '').isupper():
373
+ current = trimmed[:-1]
374
+ sections[current] = []
375
+ continue
376
+ if not current:
377
+ continue
378
+ sections[current].append(line)
379
+
380
+ # ------------------------------------------------------------------ helpers
381
+
382
+ def parse_dict(key: str) -> Dict[str, str]:
383
+ """Parse a lookup section into alias->value dict."""
384
+ result: Dict[str, str] = {}
385
+ for raw_line in sections.get(key, []):
386
+ t = raw_line.strip()
387
+ if not t:
388
+ continue
389
+ eq = t.find("=")
390
+ if eq == -1:
391
+ continue
392
+ result[t[:eq]] = t[eq + 1:]
393
+ return result
394
+
395
+ def parse_id_name(combined: str) -> Tuple[str, str]:
396
+ """Split 'id|name' → (id, name). id never contains '|'."""
397
+ pipe = combined.find("|")
398
+ if pipe == -1:
399
+ return combined, ""
400
+ return combined[:pipe], combined[pipe + 1:]
401
+
402
+ def pct_decode(s: str) -> str:
403
+ """Reverse percent-encoding applied by the serializer.
404
+ Order matters: %25 → % must be last to avoid double-decoding.
405
+ """
406
+ s = s.replace("%3D", "=")
407
+ s = s.replace("%3A", ":")
408
+ s = s.replace("%7C", "|")
409
+ s = s.replace("%5D", "]")
410
+ s = s.replace("%5B", "[")
411
+ s = s.replace("%2C", ",")
412
+ s = s.replace("%20", " ")
413
+ s = s.replace("%0A", "\n")
414
+ s = s.replace("%0D", "\r")
415
+ s = s.replace("%25", "%")
416
+ return s
417
+
418
+ # ------------------------------------------------------------------ lookup tables
419
+
420
+ T = parse_dict("T") # T1 -> technology name
421
+ TID = parse_dict("TID") # T1 -> technology UUID
422
+ ID = parse_dict("ID") # N1 -> node UUID
423
+ NAME = parse_dict("NAME") # N1 -> display name
424
+ BT = parse_dict("BT") # BT1 -> "uuid|name"
425
+ BC = parse_dict("BC") # BC1 -> "uuid|name"
426
+ DC = parse_dict("DC") # DC1 -> "uuid|name"
427
+
428
+ # Per-node blob sections
429
+ HP = parse_dict("HP") # N1 -> "id:name:type|..."
430
+ ATTR = parse_dict("ATTR") # N1 -> "name:value|..."
431
+ SCS = parse_dict("SCS") # N1 -> json string
432
+ CA = parse_dict("CA") # N1 -> json string
433
+ PA = parse_dict("PA") # N1 -> json string
434
+ SA = parse_dict("SA") # N1 -> json string
435
+ DSD = parse_dict("DSD") # N1 -> "id:name"
436
+
437
+ # ------------------------------------------------------------------ GRAPH meta
438
+
439
+ graph_dt: Optional[str] = None
440
+ graph_ts: Optional[int] = None
441
+ for raw_line in sections.get("GRAPH", []):
442
+ t = raw_line.strip()
443
+ if t.startswith("dt="):
444
+ graph_dt = t[3:]
445
+ elif t.startswith("ts="):
446
+ try:
447
+ graph_ts = int(t[3:])
448
+ except ValueError:
449
+ pass
450
+
451
+ # ------------------------------------------------------------------ edges
452
+
453
+ # Build edge map keyed by "src_alias>tgt_alias" for EP merge
454
+ edge_type_map: Dict[str, str] = {}
455
+ for raw_line in sections.get("EP", []):
456
+ t = raw_line.strip()
457
+ if not t:
458
+ continue
459
+ # Format: N1>N2 etype=direct
460
+ space_idx = t.find(" ")
461
+ pair = t[:space_idx] if space_idx != -1 else t
462
+ rest_ep = t[space_idx + 1:] if space_idx != -1 else ""
463
+ etype = ""
464
+ for kv in rest_ep.split(" "):
465
+ if kv.startswith("etype="):
466
+ etype = kv[6:]
467
+ if etype:
468
+ edge_type_map[pair] = etype
469
+
470
+ edges_in_view: List[Dict[str, Any]] = []
471
+ for raw_line in sections.get("E", []):
472
+ t = raw_line.strip()
473
+ if not t:
474
+ continue
475
+ arrow = t.find(">")
476
+ if arrow == -1:
477
+ continue
478
+ src_alias = t[:arrow].strip()
479
+ tgt_alias = t[arrow + 1:].strip()
480
+ if not src_alias or not tgt_alias:
481
+ continue
482
+ src_id = ID.get(src_alias, src_alias)
483
+ tgt_id = ID.get(tgt_alias, tgt_alias)
484
+ edge: Dict[str, Any] = {"source": src_id, "target": tgt_id}
485
+ pair_key = f"{src_alias}>{tgt_alias}"
486
+ if pair_key in edge_type_map:
487
+ edge["type"] = edge_type_map[pair_key]
488
+ edges_in_view.append(edge)
489
+
490
+ # ------------------------------------------------------------------ nodes
491
+
492
+ assets_in_view: List[Dict[str, Any]] = []
493
+
494
+ for raw_line in sections.get("N", []):
495
+ t = raw_line.strip()
496
+ if not t:
497
+ continue
498
+
499
+ # Format: N1:Column rk=... origin=... path=T1 tags=[...] bt=[...] bc=[...] dc=[...] flags=N ch=count:has_any[:href]
500
+ colon_idx = t.find(":")
501
+ if colon_idx == -1:
502
+ continue
503
+
504
+ alias = t[:colon_idx]
505
+ rest = t[colon_idx + 1:]
506
+
507
+ # Split on spaces but the first token is node type (no key=value).
508
+ # node_type is percent-decoded because pct_encode is applied on write.
509
+ raw_parts = rest.split(" ")
510
+ node_type = pct_decode(raw_parts[0]) if raw_parts else ""
511
+ kv_parts = raw_parts[1:] if len(raw_parts) > 1 else []
512
+
513
+ # Parse key=value tokens from the node line
514
+ node_kv: Dict[str, str] = {}
515
+ for part in kv_parts:
516
+ eq = part.find("=")
517
+ if eq == -1:
518
+ continue
519
+ node_kv[part[:eq]] = part[eq + 1:]
520
+
521
+ # Resolve scalar fields
522
+ asset_id = ID.get(alias, alias)
523
+ # NAME values are pct_encoded on write; decode back here.
524
+ asset_name = pct_decode(NAME.get(alias, ""))
525
+ resource_key = pct_decode(node_kv["rk"]) if "rk" in node_kv else None
526
+ origin = pct_decode(node_kv["origin"]) if "origin" in node_kv else None
527
+ identity_key = pct_decode(node_kv["ik"]) if "ik" in node_kv else None
528
+
529
+ # Technology
530
+ technology: Optional[Dict[str, Any]] = None
531
+ tech_alias = node_kv.get("path")
532
+ if tech_alias:
533
+ technology = {
534
+ "id": TID.get(tech_alias, tech_alias),
535
+ "name": T.get(tech_alias, tech_alias),
536
+ }
537
+
538
+ # Tags — each tag was individually pct_encoded on write, so decode each.
539
+ tags: List[str] = []
540
+ if "tags" in node_kv:
541
+ tags = [pct_decode(x) for x in node_kv["tags"].strip("[]").split(",") if x]
542
+
543
+ # Business terms
544
+ business_terms: List[Dict[str, Any]] = []
545
+ if "bt" in node_kv:
546
+ for k in node_kv["bt"].strip("[]").split(","):
547
+ k = k.strip()
548
+ if k and k in BT:
549
+ bt_id, bt_name = parse_id_name(BT[k])
550
+ business_terms.append({"id": bt_id, "name": bt_name})
551
+
552
+ # Business classifications
553
+ business_classifications: List[Dict[str, Any]] = []
554
+ if "bc" in node_kv:
555
+ for k in node_kv["bc"].strip("[]").split(","):
556
+ k = k.strip()
557
+ if k and k in BC:
558
+ bc_id, bc_name = parse_id_name(BC[k])
559
+ business_classifications.append({"id": bc_id, "name": bc_name})
560
+
561
+ # Data classes
562
+ data_classes: List[Dict[str, Any]] = []
563
+ if "dc" in node_kv:
564
+ for k in node_kv["dc"].strip("[]").split(","):
565
+ k = k.strip()
566
+ if k and k in DC:
567
+ dc_id, dc_name = parse_id_name(DC[k])
568
+ data_classes.append({"id": dc_id, "name": dc_name})
569
+
570
+ # Flags bitmask → individual booleans
571
+ flags = int(node_kv.get("flags", "0"))
572
+ is_deduced = bool(flags & 1)
573
+ is_transforming = bool(flags & 2)
574
+ is_operational = bool(flags & 4)
575
+ is_temporary = bool(flags & 8)
576
+ is_favorite = bool(flags & 16)
577
+
578
+ # Children (format: ch=count,has_any[,href])
579
+ children: Optional[Dict[str, Any]] = None
580
+ if "ch" in node_kv:
581
+ ch_parts = node_kv["ch"].split(",", 2)
582
+ ch_count = int(ch_parts[0]) if ch_parts else 0
583
+ ch_has_any = ch_parts[1] == "1" if len(ch_parts) > 1 else False
584
+ ch_href = ch_parts[2] if len(ch_parts) > 2 else ""
585
+ children = {"count": ch_count, "has_any": ch_has_any, "href": ch_href}
586
+
587
+ # Hierarchical path
588
+ # Encoding: "id:name:type|...".
589
+ # id is hex/UUID (no ":" or "|"). name and type have ":", "|", "%"
590
+ # percent-encoded as %3A, %7C, %25 so split(":") produces exactly 3
591
+ # tokens: [id, encoded_name, encoded_type].
592
+ hierarchical_path: List[Dict[str, Any]] = []
593
+ if alias in HP:
594
+ for segment in HP[alias].split("|"):
595
+ if not segment:
596
+ continue
597
+ seg_parts = segment.split(":")
598
+ if len(seg_parts) < 3:
599
+ continue
600
+ hierarchical_path.append({
601
+ "id": seg_parts[0],
602
+ "name": pct_decode(seg_parts[1]),
603
+ "type": pct_decode(seg_parts[2]),
604
+ })
605
+
606
+ # Attributes
607
+ # Encoding: "name=value|...". name is a system identifier (no "=").
608
+ # value may contain ":" (safe) and "|" (percent-encoded as %7C).
609
+ attributes: List[Dict[str, str]] = []
610
+ if alias in ATTR:
611
+ for attr_seg in ATTR[alias].split("|"):
612
+ eq = attr_seg.find("=")
613
+ if eq != -1:
614
+ attributes.append({
615
+ "name": attr_seg[:eq],
616
+ "value": pct_decode(attr_seg[eq + 1:]),
617
+ })
618
+
619
+ # JSON blob sections
620
+ source_code_snippets: List[Any] = json.loads(SCS[alias]) if alias in SCS else []
621
+ catalog_assignments: List[Any] = json.loads(CA[alias]) if alias in CA else []
622
+ project_assignments: List[Any] = json.loads(PA[alias]) if alias in PA else []
623
+ space_assignments: List[Any] = json.loads(SA[alias]) if alias in SA else []
624
+
625
+ # Data source definition asset
626
+ data_source_definition_asset: Optional[Dict[str, str]] = None
627
+ if alias in DSD:
628
+ colon = DSD[alias].find(":")
629
+ if colon != -1:
630
+ data_source_definition_asset = {
631
+ "id": DSD[alias][:colon],
632
+ "name": pct_decode(DSD[alias][colon + 1:]),
633
+ }
634
+
635
+ asset: Dict[str, Any] = {
636
+ "id": asset_id,
637
+ "name": asset_name,
638
+ "type": node_type,
639
+ "attributes": attributes,
640
+ "source_code_snippets": source_code_snippets,
641
+ "business_classifications": business_classifications,
642
+ "business_terms": business_terms,
643
+ "catalog_assignments": catalog_assignments,
644
+ "children": children,
645
+ "hierarchical_path": hierarchical_path,
646
+ "data_classes": data_classes,
647
+ "is_deduced": is_deduced,
648
+ "is_transforming": is_transforming,
649
+ "is_operational": is_operational,
650
+ "is_temporary": is_temporary,
651
+ "is_favorite": is_favorite,
652
+ "identity_key": identity_key,
653
+ "origin": origin,
654
+ "project_assignments": project_assignments,
655
+ "resource_key": resource_key,
656
+ "space_assignments": space_assignments,
657
+ "tags": tags,
658
+ }
659
+ if technology is not None:
660
+ asset["technology"] = technology
661
+ if data_source_definition_asset is not None:
662
+ asset["data_source_definition_asset"] = data_source_definition_asset
663
+
664
+ assets_in_view.append(asset)
665
+
666
+ # ------------------------------------------------------------------ result
667
+
668
+ result: Dict[str, Any] = {
669
+ "assets_in_view": assets_in_view,
670
+ "edges_in_view": edges_in_view,
671
+ }
672
+ if graph_dt is not None:
673
+ result["graph_calculation_datetime"] = graph_dt
674
+ if graph_ts is not None:
675
+ result["graph_calculation_timestamp"] = graph_ts
676
+ return result
677
+
678
+
679
+ def convert_json_file_to_lineage(
680
+ input_path: str,
681
+ output_path: str,
682
+ compact: bool = False
683
+ ) -> None:
684
+ """
685
+ Convert a backend LineageGraph JSON file to a lineage format (.ldf) file.
686
+
687
+ Args:
688
+ input_path: Path to input JSON file (backend LineageGraph schema)
689
+ output_path: Path to output lineage format file
690
+ compact: Whether to use compact format (no extra whitespace)
691
+ """
692
+ with open(input_path, "r", encoding="utf-8") as f:
693
+ data = json.load(f)
694
+ formatted = json_to_lineage_format(data, {"compact": compact})
695
+ with open(output_path, "w", encoding="utf-8") as f:
696
+ f.write(formatted)
697
+
698
+
699
+ def convert_lineage_file_to_json(
700
+ input_path: str,
701
+ output_path: str,
702
+ indent: int = 2
703
+ ) -> None:
704
+ """
705
+ Convert a lineage format (.ldf) file to a backend LineageGraph JSON file.
706
+
707
+ Args:
708
+ input_path: Path to input lineage format file
709
+ output_path: Path to output JSON file (backend LineageGraph schema)
710
+ indent: JSON indentation level (default: 2)
711
+ """
712
+ with open(input_path, "r", encoding="utf-8") as f:
713
+ input_text = f.read()
714
+ json_data = lineage_format_to_json(input_text)
715
+ with open(output_path, "w", encoding="utf-8") as f:
716
+ json.dump(json_data, f, indent=indent)
717
+
718
+ # Made with Bob
@@ -0,0 +1,229 @@
1
+ Metadata-Version: 2.5
2
+ Name: lineage-data-format
3
+ Version: 0.1.0
4
+ Summary: Lineage Definition Format — token-optimized serialization for data lineage graphs
5
+ Project-URL: Homepage, https://github.com/IBM/lineage-data-format
6
+ Project-URL: Repository, https://github.com/IBM/lineage-data-format
7
+ Project-URL: Issues, https://github.com/IBM/lineage-data-format/issues
8
+ Project-URL: Changelog, https://github.com/IBM/lineage-data-format/blob/main/CHANGELOG.md
9
+ Author-email: Karol Trzaska <ktrzaska@ibm.com>, Gregoire Cattan <Gregoire.Cattan@ibm.com>, Maciej Stokfisz <maciej.stokfisz@ibm.com>, Patryk Pierzchala <Patryk.Pierzchala1@ibm.com>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: data-lineage,graph,lineage,llm,serialization,token-optimization
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
+ Classifier: Typing :: Typed
23
+ Requires-Python: >=3.9
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest-cov; extra == 'dev'
26
+ Requires-Dist: pytest>=7; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # Lineage Definition Format (LDF)
30
+
31
+ [![CI](https://github.com/IBM/lineage-data-format/actions/workflows/ci.yml/badge.svg)](https://github.com/IBM/lineage-data-format/actions/workflows/ci.yml)
32
+ [![Python 3.9+](https://img.shields.io/badge/python-3.9%2B-blue.svg)](https://www.python.org/downloads/)
33
+
34
+ A Python library for converting between the backend `LineageGraph` JSON schema and a compact, token-optimized lineage definition format.
35
+
36
+ ## Installation
37
+
38
+ Install directly from GitHub:
39
+
40
+ ```bash
41
+ pip install git+https://github.com/IBM/lineage-data-format.git
42
+ ```
43
+
44
+ Pin to a specific release:
45
+
46
+ ```bash
47
+ pip install git+https://github.com/IBM/lineage-data-format.git@v0.1.0
48
+ ```
49
+
50
+ Install from source for development:
51
+
52
+ ```bash
53
+ git clone https://github.com/IBM/lineage-data-format.git
54
+ cd lineage-data-format
55
+ pip install -e ".[dev]"
56
+ ```
57
+
58
+ ## Input Schema
59
+
60
+ Both `json_to_lineage_format` and `convert_json_file_to_lineage` expect the backend `LineageGraph` response format:
61
+
62
+ ```json
63
+ {
64
+ "assets_in_view": [ /* list of LineageAsset objects */ ],
65
+ "edges_in_view": [ /* list of FlowEdge objects */ ],
66
+ "graph_calculation_datetime": "2024-07-22T08:16:22.694Z",
67
+ "graph_calculation_timestamp": 1721636182694
68
+ }
69
+ ```
70
+
71
+ ### LineageAsset fields
72
+
73
+ | Field | Type | Notes |
74
+ |---|---|---|
75
+ | `id` | string | Asset UUID |
76
+ | `name` | string | Display name |
77
+ | `type` | string | e.g. `"Column"`, `"Table"` |
78
+ | `resource_key` | string | e.g. `"PostgreSQL/db/schema/table/col"` |
79
+ | `origin` | string | e.g. `"runtime"` |
80
+ | `technology` | `{id, name}` | Technology lookup |
81
+ | `hierarchical_path` | `[{id, name, type}]` | Ancestry path |
82
+ | `attributes` | `[{name, value}]` | Asset attributes |
83
+ | `tags` | `string[]` | Tag list |
84
+ | `business_terms` | `[{id, name}]` | |
85
+ | `business_classifications` | `[{id, name}]` | |
86
+ | `data_classes` | `[{id, name}]` | |
87
+ | `source_code_snippets` | array | Full snippet objects |
88
+ | `catalog_assignments` | array | Full assignment objects |
89
+ | `project_assignments` | array | Full assignment objects |
90
+ | `space_assignments` | array | Full assignment objects |
91
+ | `data_source_definition_asset` | `{id, name}` | |
92
+ | `children` | `{count, has_any, href}` | Child summary |
93
+ | `is_deduced` | bool | |
94
+ | `is_transforming` | bool | |
95
+ | `is_operational` | bool | |
96
+ | `is_temporary` | bool | |
97
+ | `is_favorite` | bool | |
98
+
99
+ ### FlowEdge fields
100
+
101
+ | Field | Type | Notes |
102
+ |---|---|---|
103
+ | `source` | string | Source asset UUID |
104
+ | `target` | string | Target asset UUID |
105
+ | `type` | `"direct"` \| `"summary"` | Edge type |
106
+
107
+ ## Usage
108
+
109
+ ### As a Library
110
+
111
+ ```python
112
+ from ldf import (
113
+ json_to_lineage_format,
114
+ lineage_format_to_json,
115
+ convert_json_file_to_lineage,
116
+ convert_lineage_file_to_json,
117
+ )
118
+
119
+ # Convert a backend LineageGraph dict to LDF string
120
+ ldf_text = json_to_lineage_format(backend_response)
121
+
122
+ # Convert LDF string back to backend LineageGraph dict
123
+ restored = lineage_format_to_json(ldf_text)
124
+
125
+ # Convert files directly
126
+ convert_json_file_to_lineage('input.json', 'output.ldf')
127
+ convert_lineage_file_to_json('input.ldf', 'output.json')
128
+
129
+ # Compact mode (single blank line between sections instead of two)
130
+ ldf_compact = json_to_lineage_format(backend_response, {'compact': True})
131
+ ```
132
+
133
+ ### Command Line Interface
134
+
135
+ ```bash
136
+ # Convert JSON to lineage format
137
+ ldf json-to-lineage input.json output.ldf
138
+
139
+ # Convert with compact format (minimal blank lines)
140
+ ldf json-to-lineage input.json output.ldf --compact
141
+
142
+ # Convert lineage format back to JSON
143
+ ldf lineage-to-json input.ldf output.json
144
+
145
+ # Specify JSON indentation
146
+ ldf lineage-to-json input.ldf output.json --indent 4
147
+ ```
148
+
149
+ ## Format Overview
150
+
151
+ The Lineage Definition Format is a compact, plain-text format that defines repeated values once in named lookup sections and references them via short aliases throughout. All sections are optional except `GRAPH`, `START`, `E`, and `N`.
152
+
153
+ ### Section Reference
154
+
155
+ | Section | Type | Content |
156
+ |---|---|---|
157
+ | `GRAPH` | Structural | Marker line + optional `dt=` / `ts=` meta |
158
+ | `START` | Structural | Alias of the first asset |
159
+ | `E` | Structural | Directed edges: `N1>N2` |
160
+ | `EP` | Structural | Edge properties: `N1>N2 etype=direct` |
161
+ | `N` | Structural | Node definitions (see format below) |
162
+ | `T` | Lookup | Technology names: `T1=PostgreSQL` |
163
+ | `TID` | Lookup | Technology UUIDs: `T1=<uuid>` |
164
+ | `ID` | Lookup | Node UUIDs: `N1=<uuid>` |
165
+ | `NAME` | Lookup | Node display names: `N1=first_name` |
166
+ | `BT` | Lookup | Business terms: `BT1=<uuid>\|Term Name` |
167
+ | `BC` | Lookup | Business classifications: `BC1=<uuid>\|Name` |
168
+ | `DC` | Lookup | Data classes: `DC1=<uuid>\|Name` |
169
+ | `HP` | Per-node | Hierarchical path: `N1=id:name:type\|…` |
170
+ | `ATTR` | Per-node | Asset attributes: `N1=name:value\|…` |
171
+ | `SCS` | Per-node | Source code snippets (JSON): `N1=[…]` |
172
+ | `CA` | Per-node | Catalog assignments (JSON): `N1=[…]` |
173
+ | `PA` | Per-node | Project assignments (JSON): `N1=[…]` |
174
+ | `SA` | Per-node | Space assignments (JSON): `N1=[…]` |
175
+ | `DSD` | Per-node | Data source definition asset: `N1=id:name` |
176
+
177
+ ### Node Line Format
178
+
179
+ ```
180
+ N1:Column rk=PostgreSQL/db/s1/t/col origin=runtime path=T1 tags=[PII] bt=[BT1] bc=[BC1] dc=[DC1] flags=0 ch=0,0,https://…/children
181
+ ```
182
+
183
+ | Token | Meaning |
184
+ |---|---|
185
+ | `N1:Column` | alias:type |
186
+ | `rk=…` | `resource_key` |
187
+ | `origin=…` | `origin` |
188
+ | `path=T1` | technology alias (→ `T` / `TID` lookup) |
189
+ | `tags=[…]` | comma-separated tag list |
190
+ | `bt=[…]` | business term aliases |
191
+ | `bc=[…]` | business classification aliases |
192
+ | `dc=[…]` | data class aliases |
193
+ | `flags=N` | bitmask: bit0=`is_deduced`, bit1=`is_transforming`, bit2=`is_operational`, bit3=`is_temporary`, bit4=`is_favorite`; omitted when 0 |
194
+ | `ch=count,has_any,href` | children summary; comma-separated to avoid conflicts with URLs |
195
+
196
+ ### Example Output
197
+
198
+ See [`examples/output_backend.ldf`](examples/output_backend.ldf) for the full LDF representation of [`examples/mock_backend_response.json`](examples/mock_backend_response.json).
199
+
200
+ ## Features
201
+
202
+ - **Token-optimized**: Reduces token count by 4–6× compared to JSON
203
+ - **Bidirectional / lossless**: Full round-trip fidelity for all backend schema fields
204
+ - **Fully self-describing**: All lookup sections are embedded in the document
205
+ - **Human-readable**: Plain text, no binary encoding
206
+ - **CLI included**: Easy command-line conversion tools
207
+
208
+ ## Development
209
+
210
+ ```bash
211
+ # Create virtual environment and install dev dependencies
212
+ python3 -m venv .venv
213
+ source .venv/bin/activate
214
+ pip install -e ".[dev]"
215
+
216
+ # Run tests
217
+ pytest
218
+
219
+ # Run tests with coverage
220
+ pytest --cov=ldf
221
+ ```
222
+
223
+ ## License
224
+
225
+ See [LICENSE](LICENSE) file for details.
226
+
227
+ ## Contributing
228
+
229
+ Contributions are welcome! Please feel free to submit a Pull Request.
@@ -0,0 +1,8 @@
1
+ ldf/__init__.py,sha256=82qF_JkhEg0Rhpv4QQACGEpPVqA4wBOxrUA3Dn5rdLI,529
2
+ ldf/cli.py,sha256=j0licFkAYbLg638hhEr3-1rcKOuc8lV63Dxx7sQE-vE,2677
3
+ ldf/converter.py,sha256=CgrpowVZh-8Rtzt0qUhfki-FrmobWeutD7Wm3hqfBcU,27285
4
+ lineage_data_format-0.1.0.dist-info/METADATA,sha256=wEisT6zf7A51ZnSlwkKscxGKy4SRKt8tNfGxTvlbjBk,8084
5
+ lineage_data_format-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
6
+ lineage_data_format-0.1.0.dist-info/entry_points.txt,sha256=u0ZtRh_c2aaI9XUBA7SGEcIWWIEMhdP3G5bdFzqogEs,37
7
+ lineage_data_format-0.1.0.dist-info/licenses/LICENSE,sha256=7w8RzeB0PCdSS_GofVO7jOn7rHe7AiOHFdQ4ceuuj0Y,1518
8
+ lineage_data_format-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ ldf = ldf.cli:main
@@ -0,0 +1,28 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, International Business Machines
4
+
5
+ Redistribution and use in source and binary forms, with or without
6
+ modification, are permitted provided that the following conditions are met:
7
+
8
+ 1. Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ this list of conditions and the following disclaimer in the documentation
13
+ and/or other materials provided with the distribution.
14
+
15
+ 3. Neither the name of the copyright holder nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
23
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
25
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.