Changeset - d4de13e83b7f
[Not reviewed]
default
0 1 0
Drew Perttula - 8 years ago 2017-05-10 07:00:22
drewp@bigasterisk.com
graph.js don't error if a statement is in multiple graphs
Ignore-this: 6ba903b20b1177dea8e0c96d0ab67d6
1 file changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -222,20 +222,22 @@ class window.SyncedGraph
 
    # forget your queries from the first time).
 
    @_autoDeps.runHandler(func, label)
 

	
 
  _singleValue: (s, p) ->
 
    @_autoDeps.askedFor(s, p, null, null)
 
    quads = @graph.findByIRI(s, p)
 
    switch quads.length
 
    objs = new Set(q.object for q in quads)
 
    
 
    switch objs.size
 
      when 0
 
        throw new Error("no value for "+s+" "+p)
 
      when 1
 
        obj = quads[0].object
 
        obj = objs.values().next().value
 
        return obj
 
      else
 
        throw new Error("too many values: " + JSON.stringify(quads))
 
        throw new Error("too many different values: " + JSON.stringify(quads))
 

	
 
  floatValue: (s, p) ->
 
    key = s + '|' + p
 
    hit = @cachedFloatValues.get(key)
 
    return hit if hit != undefined
 

	
0 comments (0 inline, 0 general)