MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / findAllEdges

Function findAllEdges

union/Santos/preprocess_yago.py:42–59  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

40 return dictionary
41
42def findAllEdges(path):
43 i = 1
44 j = 1
45 edges = []
46 with open(path,'r', encoding = "UTF-8") as infile:
47 for line in infile:
48 line = line.lower()
49 #sample line: <http://yago-knowledge.org/resource/fishing_tackle> <http://www.w3.org/2000/01/rdf-schema#subclassof> <http://schema.org/thing> .
50 j+=1
51 if "rdf-schema#subclassof" in line and "http://schema.org/thing" not in line:
52 parent, child = getParentAndChild(line)
53 edges.append((parent,child))
54 i+=1
55 if i % 1000 == 0:
56 print("Written lines:",i)
57 print("Processed lines:",j)
58 print("Class file written in class dictionary.")
59 return edges
60
61#using bfs to create the inheritance dictionary:
62class Hierarchy:

Callers 1

preprocess_yago.pyFile · 0.85

Calls 1

getParentAndChildFunction · 0.85

Tested by

no test coverage detected