# HG changeset patch # User Drew Perttula # Date 2017-05-10 07:00:22 # Node ID d4de13e83b7fd5f75d802715d6eb51be5b1b32f3 # Parent c962f19c732856cc0608ad2f3f6c0cc9adaa07f4 graph.js don't error if a statement is in multiple graphs Ignore-this: 6ba903b20b1177dea8e0c96d0ab67d6 diff --git a/light9/web/graph.coffee b/light9/web/graph.coffee --- a/light9/web/graph.coffee +++ b/light9/web/graph.coffee @@ -225,14 +225,16 @@ class window.SyncedGraph _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