--
You received this message because you are currently subscribed to the "OpenAnzo" group.
To post to this group, send email to open...@googlegroups.com
To unsubscribe from this group, send email to openanzo-u...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/openanzo?hl=en
Hi Michael,
I'm glad you found your issue.
An important part of the Anzo.js API is that is can replicate a graph to
memory and that replica is automatically kept up-to-date when data
changes on the server. The way that the Anzo.js API accomplishes that is
using a COMET technique
(http://en.wikipedia.org/wiki/Comet_%28programming%29). One downside to
that technique is that you can end up hitting the browser-imposed limit
on the number of simultaneous open connections to a single hostname.
Opening multiple tabs or windows of the same browser instance is the
most common way to hit that limit. The limit can range from 2 to 8
depending on browser vendor, version, and settings. There are ways
around that, such as wildcard DNS. A recommended technique, especially
since you mentioned you are working in a browser plugin, is to share a
single connection among tabs, if possible.
Relating to your problem of logging out too early, I have some other advice:
Almost everything that the Anzo.js does is asynchronous so you
definitely have to watch out when you are closing things. There is an
event that might be useful to you:
updateRepositoryComplete
It is fired whenever an updateRepository() operation actually is
finished. If you call updateRepository(), you may want to wait for
updateRepositoryComplete to fire before doing more things.
In the AnzoClient.js file, the comments for the updateRepository method
explain some of how to listen. It says something like:
One can register listeners to the updateRepositoryComplete method by
using dojo's connect method:
var handle = dojo.connect(anzoClient, 'updateRepositoryComplete',
function(success, errors) { <DO SOMETHING> });
Later, to disconnect the event handler you can do:
dojo.disconnect(handle);
The updateRepositoryComplete handler is given the following argument:
success: Boolean
True if update was successful, false otherwise.
errors: The errors object contain raw information about errors that may
have happened during update. This is opaque debugging data mainly.
Rendering as a JSON string is recommended.
On a slightly separate note, in your code I see that you use replicaFind
to look for data and then you add data to a graph using the graph
object's 'add' method (e.g. higgins.userRootGraph.add(currentEMail) ).
Presumably, userRootGraph was obtained using the getReplicaGraph method.
If so, then you can get the same effect as replicaFind by just calling
userRootGraph.find(). If you use the find method on the graph, you can
omit the last parameter (the namedGraphUri) since the named graph URI is
implicit from the fact that you are calling find on that graph. The
results will be limited to data inside that graph. The only reason to
use replicaFind is if you need to search across more than one graph.
Also, I notice that you often create a statement object using a call to
anzo.createStatement and then pass that directly to an 'add' method.
That is fine but you the 'add' method has another form that can save you
that step. You can just do:
var longitudeLiteral = anzo.createLiteral(coords.longitude,
"http://www.w3.org/2001/XMLSchema#string");
higgins.userRootGraph.add(higgins.userRootPersonURI,
higgins.vLongitudeURI, currentLatitude);
Notice the form of add that just takes the subject, predicate, and
object as separate arguments. The fourth part of the statement, the
named graph uri, is implicit because you are calling 'add' on a graph.
So that graph's uri will be used as the named graph uri for the added
statement.
Hope that helps.
> On Thu, Feb 10, 2011 at 8:43 PM, Michael McIntosh
> <mike.g....@gmail.com <mailto:mike.g....@gmail.com>> wrote:
>
> Nevermind - it looks like I logged out too early.
>
> On Feb 10, 6:42 pm, Michael McIntosh <mmcint...@acm.org
> <mailto:tcarr...@azigo.com>","language":"http://www.w3.org/2001/XMLSchema#string","_string":"\"tcarr...@azigo.com
> <mailto:tcarr...@azigo.com>\"@http://www.w3.org/2001/XMLSchema#string"},"namedGraphUri":{"value":"http://higgins.eclipse.org/pds/mike/root","namespace":"http://higgins.eclipse.org/pds/mike/","localname":"root"},"_dictionaryKey":"{http://higgins.eclipse.org/pds/mike/root#me,http://www.w3.org/2006/vcard/Email,
> \"tcarr...@azigo.com
> <mailto:tcarr...@azigo.com>\"@http://www.w3.org/2001/XMLSchema#string,http://higgins.eclipse.org/pds/mike/root}"}]
> > Adding:
> {"subject":{"value":"http://higgins.eclipse.org/pds/mike/root#me
> > ","namespace":"http://higgins.eclipse.org/pds/mike/root#
> >
> ","localname":"me"},"predicate":{"value":"http://www.w3.org/2006/vcard/Email
> > ","namespace":"http://www.w3.org/2006/vcard/
> > ","localname":"Email"},"object":{"value":"tcarr...@azigo.com
> <mailto:tcarr...@azigo.com>","language":"http://www.w3.org/2001/XMLSchema#string","_string":"\"tcarr...@azigo.com
> <mailto:tcarr...@azigo.com>\"@http://www.w3.org/2001/XMLSchema#string"},"namedGraphUri":{"value":"http://higgins.eclipse.org/pds/mike/root","namespace":"http://higgins.eclipse.org/pds/mike/","localname":"root"},"_dictionaryKey":"{http://higgins.eclipse.org/pds/mike/root#me,http://www.w3.org/2006/vcard/Email,
> \"tcarr...@azigo.com
> <mailto:tcarr...@azigo.com>\"@http://www.w3.org/2001/XMLSchema#string,http://higgins.eclipse.org/pds/mike/root}"}
> >
> > The console log for the sequence that works incorrectly contains:
> > Adding:
> {"subject":{"value":"http://higgins.eclipse.org/pds/mike/root#me
> > ","namespace":"http://higgins.eclipse.org/pds/mike/root#
> >
> ","localname":"me"},"predicate":{"value":"http://www.w3.org/2006/vcard/latitude","namespace":"http://www.w3.org/2006/vcard/
> >
> ","localname":"latitude"},"object":{"value":"40.858432","language":"http://www.w3.org/2001/XMLSchema#string","_string":"\"40.858432\"@http://www.w3.org/2001/XMLSchema#string"},"namedGraphUri":{"value":"http://higgins.eclipse.org/pds/mike/root","namespace":"http://higgins.eclipse.org/pds/mike/","localname":"root"}}
> > Adding:
> {"subject":{"value":"http://higgins.eclipse.org/pds/mike/root#me
> > ","namespace":"http://higgins.eclipse.org/pds/mike/root#
> >
> ","localname":"me"},"predicate":{"value":"http://www.w3.org/2006/vcard/longitude","namespace":"http://www.w3.org/2006/vcard/
> >
> ","localname":"longitude"},"object":{"value":"-74.163755","language":"http://www.w3.org/2001/XMLSchema#string","_string":"\"-74.163755\"@http://www.w3.org/2001/XMLSchema#string"},"namedGraphUri":{"value":"http://higgins.eclipse.org/pds/mike/root","namespace":"http://higgins.eclipse.org/pds/mike/","localname":"root"}}
> >
> > The major difference between the two is that the statements that
> don't
> > persist are missing the _dictionaryKey element.
> >
> > Can anyone provide some guidance on why this is happening?
> >
> > Regards,
> > Mike
>
> --
> You received this message because you are currently subscribed to
> the "OpenAnzo" group.
>
> To post to this group, send email to open...@googlegroups.com
> <mailto:open...@googlegroups.com>
> To unsubscribe from this group, send email to
> openanzo-u...@googlegroups.com
> <mailto:openanzo-u...@googlegroups.com>
>
> For more options, visit this group at
> http://groups.google.com/group/openanzo?hl=en
>
>
> --
> You received this message because you are currently subscribed to the
> "OpenAnzo" group.
>
> To post to this group, send email to open...@googlegroups.com
> To unsubscribe from this group, send email to
> openanzo-u...@googlegroups.com
>
> For more options, visit this group at
> http://groups.google.com/group/openanzo?hl=en
--
Jordi Albornoz Mulligan
Founding Engineer - Cambridge Semantics
jo...@cambridgesemantics.com
(617) 401-7321