Changeset - 7e66643b3f54
[Not reviewed]
default
0 2 0
Drew Perttula - 7 years ago 2018-05-18 07:54:06
drewp@bigasterisk.com
quieter graph logs
Ignore-this: f24071530e1ecc5c2b7a7de184f438ac
2 files changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
light9/web/graph.coffee
Show inline comments
 
@@ -215,27 +215,27 @@ class window.SyncedGraph
 
      for q in qs
 
        if not q.equals
 
          throw new Error("doesn't look like a proper Quad")
 
        if not q.graph?
 
          throw new Error("corrupt patch: #{JSON.stringify(q)}")
 
    
 
  _applyPatch: (patch) ->
 
    # In most cases you want applyAndSendPatch.
 
    # 
 
    # This is the only method that writes to @graph!
 
    @cachedFloatValues.clear()
 
    for quad in patch.delQuads
 
      log("remove #{JSON.stringify(quad)}")      
 
      #log("remove #{JSON.stringify(quad)}")      
 
      did = @graph.removeQuad(quad)
 
      log("removed: #{did}")
 
      #log("removed: #{did}")
 
    for quad in patch.addQuads
 
      @graph.addQuad(quad)
 
    #log('applied patch locally', patchSizeSummary(patch))
 
    @_autoDeps.graphChanged(patch)
 

	
 
  getObjectPatch: (s, p, newObject, g) ->
 
    # make a patch which removes existing values for (s,p,*,c) and
 
    # adds (s,p,newObject,c). Values in other graphs are not affected.
 
    existing = @graph.getQuads(s, p, null, g)
 
    return {
 
      delQuads: existing,
 
      addQuads: [@Quad(s, p, newObject, g)]
 
@@ -252,25 +252,24 @@ class window.SyncedGraph
 
    # helps with memleak? not sure yet. The point was if two matching
 
    # labels get puushed on, we should run only one. So maybe
 
    # appending a serial number is backwards.
 
    @serial = 1 if not @serial
 
    @serial += 1
 
    #label = label + @serial
 
    
 
    @_autoDeps.runHandler(func, label)
 

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

	
 
  floatValue: (s, p) ->
light9/web/rdfdb-synced-graph.html
Show inline comments
 
<link rel="import" href="/lib/polymer/polymer-element.html">
 
<script src="/node_modules/n3/n3-browser.js"></script>
 
<script src="/lib/async/dist/async.js"></script>
 
      <script src="/lib/underscore/underscore-min.js"></script>
 

	
 
<dom-module id="rdfdb-synced-graph">
 
  <template>
 
    <style>
 
     :host {
 
         display: inline-block;
 
         border: 1px solid gray;
 
         width: 18em;
 
         width: 20em;
 
         background: #05335a;
 
         color: #4fc1d4;
 
     }
 
    </style>
 
    graph: [[status]]
 
  </template>
 
  <script src="rdfdbclient.js"></script>
 
  <script src="graph.js"></script>
 
  <script>
 
   class RdfdbSyncedGraph extends Polymer.Element {
 
       static get is() { return "rdfdb-synced-graph"; }
 
       
0 comments (0 inline, 0 general)