Hi,
I am trying to create knowledge graph using neo4j. I have followed the steps mentioned below.
- Created an OWL file (with machine name, city, state, country)
- Loaded the OWL in to neo4j using neosemantics
- Loaded the data for one machine
- Loaded the data for second machine
I would like to maintain an hierarchy for each machine but all the nodes are getting interlinked.
So iam not able to maintain an hierarchy as such.
Machines ------> Machine 1 ---> Name, city, state, country
------> Machine 2 ---> Name, city, state, country
Let me know if it is possible to have single OWL file and have different machines
based on it.
Hi @asathyapriya , could you please share your ontology / data and the data load scripts please?
If not all maybe a fragment so we can understand what do you mean by interlinked.
Hopefully we should be able to explain and provide alternatives.
Thanks
JB.
Hi, Thanks for the quick reply.
Please find attached the Sample OWL file and the data.
I have executed the following scripts
**1. Initial Configuration**
CALL n10s.graphconfig.init();
**2. Load the OWL file**
CALL n10s.onto.import.fetch("file:///C:\\SampleOWL.owl", "RDF/XML");
**3. Load the data and create the appropriate node**
LOAD CSV WITH HEADERS FROM "file:///d:/machinedata_2.csv" AS row
MERGE (m:MachineNumer { machineNumber: row.machineNumber })
MERGE (r:Region { regionName: row.region })
MERGE (c:City { cityName: row.city })
MERGE (z:Zip { zipCode: row.zip })
MERGE (i:Item { itemId: row.machineNumber})
ON CREATE SET i.machine = row.machineNumber
MERGE (i)-[:HAS_CODE]->(m)
MERGE (i)-[:IN_REGION]->(r)
MERGE (i)-[:IN_CITY]->(c)
MERGE (i)-[:HAS_ZIP]->(z)
**4. Establish the connection between the ontology and the data**
match(i:Item{}),(c:Class{name:'Machine'}) CREATE (i)-[:iSA]->(c)
One more thing I would like to handle is the machine specific property( in the Class)
For example, each machine will have unique part number for the (R1Part1,R1Part2, R2Part1, R2Part2) .
But if I set the node (For example: R1Part1)property with partnumber, it will be overwritten by the last machine part number as its the same node.
Please let me know if there is a better approach to set /handle the machine specific properties in the nodes generated by OWL file.
Machine Data:
machineNumber region city zip R1Part1 R1Part2 R2Part2 R2Part1
machine 1 DE Brande 66740 1 2 3 4
machine 2 IT Crande 80145 5 6 7 8
machine 3 DE Drande 1067 9 10 11 12
[SampleOWL.txt|attachment](upload://fnM0JwXsVkis0nh2jlkmVZNtSS9.txt) (6.0 KB)