Exemple #1
0
 def load(file):
     """Return a simpleGraphComponent with all the components loaded from
     a file.  The format of the file is that each line is a tab-separated 
     triple of edgelabel, sourceNode, destNode."""
     p = GraphPlugin(label=file)
     for line in util.linesOf(file, interval=100000):
         if not line.startswith("#") and line.strip():
             try:
                 edgeLabel, src, dst = line.strip().split("\t")
                 edgeLabel = edgeLabel.strip()
                 src = src.strip()
                 dst = dst.strip()
                 p.addEdge(edgeLabel, src, dst)
             except KeyError:
                 print 'bad line:', line
     return p
Exemple #2
0
 def load(file):
     """Return a simpleGraphComponent with all the components loaded from
     a file.  The format of the file is that each line is a tab-separated 
     triple of edgelabel, sourceNode, destNode."""
     p = GraphPlugin(label=file)
     for line in util.linesOf(file,interval=100000):
         if not line.startswith("#") and line.strip():
             try:
                 edgeLabel,src,dst = line.strip().split("\t")
                 edgeLabel = edgeLabel.strip()
                 src = src.strip()
                 dst = dst.strip()
                 p.addEdge(edgeLabel,src,dst)
             except KeyError:
                 print 'bad line:',line
     return p
Exemple #3
0
 def load(file):
     """Return a simpleGraphComponent with all the components loaded from
     a file.  The format of the file is that each line is a tab-separated 
     triple of edgelabel, sourceNode, destNode."""
     p = FactPlugin(label=file)
     for line in util.linesOf(file, interval=100000):
         if not line.startswith("#") and line.strip():
             try:
                 parts = line.strip().split("\t")
                 functor = parts[0].strip()
                 src = parts[1].strip()
                 dsts = map(lambda x: x.strip(), parts[2:])
                 p.addFact(functor, src, dsts)
             except KeyError:
                 print 'bad line:', line
     return p
Exemple #4
0
 def load(file):
     """Return a simpleGraphComponent with all the components loaded from
     a file.  The format of the file is that each line is a tab-separated 
     triple of edgelabel, sourceNode, destNode."""
     p = FactPlugin(label=file)
     for line in util.linesOf(file,interval=100000):
         if not line.startswith("#") and line.strip():
             try:
                 parts = line.strip().split("\t")
                 functor = parts[0].strip()
                 src = parts[1].strip()
                 dsts = map(lambda x:x.strip(), parts[2:])
                 p.addFact(functor,src,dsts)
             except KeyError:
                 print 'bad line:',line
     return p