Changeset - eccb02a704cf
[Not reviewed]
default
0 1 0
Drew Perttula - 11 years ago 2014-06-15 07:07:09
drewp@bigasterisk.com
big speedup on graph.contains
Ignore-this: 53c970be29bac62467052ba11cedce53
1 file changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
light9/rdfdb/rdflibpatch.py
Show inline comments
 
@@ -53,7 +53,11 @@ def inGraph(spoc, graph):
 
    c is just a URIRef.
 
    Workaround for https://github.com/RDFLib/rdflib/issues/398
 
    """
 
    return (spoc[:3] + (Graph(identifier=spoc[3]),)) in graph.quads()
 
    spoi = spoc[:3] + (Graph(identifier=spoc[3]),)
 
    if spoi not in graph:
 
        # this is a huge speedup, avoid many whole-graph scans
 
        return False
 
    return spoi in graph.quads()
 

	
 

	
 
def graphFromQuads(q):
0 comments (0 inline, 0 general)