Ozan Baris Mulayim
06/26/2024, 3:59 PMBill H
06/26/2024, 6:01 PMwey
06/28/2024, 10:23 AM(:Entity)-[:RELATIONSHIP]->(:Entity)
, where you put RELATIONSHIP.name as the Predicate, `Entity.name`as Subject& Object
for instance:
In [1]: import rdflib
...:
...: g = rdflib.Graph()
...: g.parse("acad.ttl", format="ttl")
Out[1]: <Graph identifier=N8879a2d625384bf89a1e40ea3ccba3ef (<class 'rdflib.graph.Graph'>)>
In [2]: for subj, pred, obj in g:
...: print(f"Subject: {subj}, Predicate: {pred}, Object: {obj}")
...:
Subject: <http://buildsys.org/ontologies/ACAD#RM2375>, Predicate: <https://brickschema.org/schema/Brick#hasPart>, Object: <http://buildsys.org/ontologies/ACAD#RM2375_room>
Subject: <http://buildsys.org/ontologies/ACAD#ACAD.ZONE.AHU01.RM2368_MIX.Zone_Air_Temp>, Predicate: <http://www.w3.org/2000/01/rdf-schema#label>, Object: ACAD.ZONE.AHU01.RM2368_MIX.Zone Air Temp
"RM2375" - "hasPart"-> "RM2375_room"
And "http://buildsys.org/ontologies/ACAD#RM2375" is the vertex id, "RM2375" is the property name
With that ETL processing, you could leverage nebula-importer/nebula-studio to ingest the csv files to NebulaGraph with ease.
The schema for reference would be:
CREATE SPACE IF NOT EXISTS relaxed_brick (vid_type=FIXED_STRING(256));
-- wait for space creation ---
USE relaxed_brick;
CREATE TAG IF NOT EXISTS Entity(name string);
CREATE EDGE IF NOT EXISTS RELATIONSHIP(name int);
-- wait for DDL done ---
CREATE TAG INDEX Entity_index on Entity(name(128));
CREATE EDGE INDEX IF NOT EXISTS RELATIONSHIP_index on RELATIONSHIP(name(128));
wey
06/28/2024, 10:26 AM