X3JReader

2 views
Skip to first unread message

Markus Sabadello

unread,
Oct 8, 2010, 2:16:38 AM10/8/10
to Joseph Boyle, Michael Schwartz, personal...@googlegroups.com
Joseph,

Mike is trying to send the following X3J message to the PDS:

{"=me": {"$get": {"$": null}}}

This should be equivalent to the following in X3 Simple:

=me
    $get
        /
            $

(To test this, you could go to the XDI Converter, enter the X3 Simple and convert it to X3J).

When sending this message to a PDS, it should ALWAYS return some data (the context self-descriptor).
But when Mike sends it in X3J, he gets no response.

I did some research and think it's a bug in your X3JReader.
It seems your code actually converts the above JSON to the following X3 Simple equivalent:

=me
    $get
        "{\"$\":null}"

Could you take a look and work with Mike to fix this..?

Mike, as a quick workaround, you could send your messages in one of the other supported formats, e.g. X3 Standard, which would look like this:
[=me[$get[[$]]]]

Markus

Joseph Boyle

unread,
Oct 8, 2010, 2:52:57 AM10/8/10
to Markus Sabadello, Michael Schwartz, personal...@googlegroups.com
It looks like the String reader is accepting anything, so probably the order of these two blocks should be exchanged:

// XDI object is literal:
String jsonLiteralString = null;
if ((jsonLiteralString = predicateObject.optString(predkey)) != null) {
//if (jsonLiteralObject != null && TypeConstants.XRI_TYPE_JSON.equals(Types.getPredicateType(predicate))) {
predicate.createLiteral(jsonLiteralString);
continue;
}
// XDI object is subcontext:
JSONObject innerGraphObject = null;
if ((innerGraphObject = predicateObject.optJSONObject(predkey)) != null) {
Graph innerGraph = predicate.createInnerGraph(null);
this.read(innerGraph, innerGraphObject);
continue;
}

I am not sure I have a build and test installation of XDI Converter (though I do have a partial Scala version I wrote somewhere) so while I keep looking into it, you may want to make the above fix.

Drummond Reed

unread,
Oct 8, 2010, 2:54:28 AM10/8/10
to personal...@googlegroups.com, Joseph Boyle, Michael Schwartz
This suggests our work item for the second part of tomorrow's call, which is mapping the new JSON serialization to X3 statements. If we can work out that map, and it's lossless, then there's no question that we can build a new JSON serialization module for XDI4J, and we'd be able to rock 'n roll forward as Mike would like.

If I could stay awake further here tonight, I'd work on it now, but I stayed up too late last night, so we'll do it live tomorrow (if we have time after the OAuth stuff).

'night,

=Drummond

Markus Sabadello

unread,
Oct 8, 2010, 4:05:18 AM10/8/10
to Joseph Boyle, Michael Schwartz, personal...@googlegroups.com
Mike,

Please try "git pull" and rebuild the PDS. You should have a fresh version of xdi4j then.
Then try sending your X3J message again, I think it will work.

Markus

Markus Sabadello

unread,
Oct 8, 2010, 4:06:22 AM10/8/10
to Joseph Boyle, Michael Schwartz, personal...@googlegroups.com
Yes I think this works, I just checked it into xdi4j.

Markus

On Fri, Oct 8, 2010 at 8:52 AM, Joseph Boyle <boyle....@gmail.com> wrote:

Michael Schwartz

unread,
Oct 10, 2010, 1:28:45 PM10/10/10
to Personal Data Store Project

I think we should add an FAQ item about modifying:

$DIST/personaldatastore/pds.core/src/main/webapp/WEB-INF/applicationContext.xml

to the bottom of the "Building" page:
http://www.projectnori.org/code/building

- Mike

Markus Sabadello

unread,
Oct 10, 2010, 5:10:26 PM10/10/10
to personal...@googlegroups.com
Well I think the "Building" page should just be about getting something to work quickly, the details are on other pages.

The page does have links to the "pds-core" and "pds-core-single" components, which should have more details on how to configure the PDS.
E.g. http://projectnori.pbworks.com/pds-core-single

Oops the links to the wiki are still broken. Need to fix that.

Markus
Reply all
Reply to author
Forward
0 new messages