BrickSchema / py-brickschema

Python package for working with Brick (brickschema.org/)
Other
55 stars 15 forks source link

convert Haystack JSON model #57

Open jli113 opened 3 years ago

jli113 commented 3 years ago

After downloading bravo.json, running the following lines:

import json from brickschema import Graph model = json.load(open("bravo.json")) g = Graph(load_brick=True).from_haystack("http://project-haystack.org/bravo#", model)

File "C:\Users*\anaconda3\envs\Brick\lib\site-packages\brickschema\inference.py", line 711, in entities = {e["id"].replace('"', ""): {"tags": e} for e in entities}

AttributeError: 'dict' object has no attribute 'replace'

gtfierro commented 3 years ago

Aha! This is due to Haystack changing the encoding of id fields in their JSON exports; I will push a fix for this soon

The ids used to look like: {"id": "0001"} but now they look like {"id": {"_kind": "ref", "dis": "0001", "val": "0001"}}

gtfierro commented 3 years ago

Upon further investigation, many aspects of the Haystack JSON export have changed, requiring a deeper rewrite of the Haystack to Brick translation module