(path)
| 40 | return dictionary |
| 41 | |
| 42 | def 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: |
| 62 | class Hierarchy: |
no test coverage detected