[x3d-public] [x3dom-developers] [x3dom-users] Improvements to the unofficial *X3D* JSON loader [ implicit and explicit namespaces ]

Don Brutzman brutzman at nps.edu
Sun Nov 15 13:56:04 PST 2015


Hmmm thanks for the interesting post John.  Not sure that I fully understand the specific problem tho.

Name scope and name spaces are a topic for an upcoming X3D Working Group meeting (this week?) and this can be confusing as we deconflict and integrate X3D, XML/XHTML, HTML/DOM etc.

Assets: X3DOM has a rich set of working examples.  Also all of the existing scene archive examples include .xhtml version that has HTML with X3DOM wrapping source from each .x3d scene.

Summary of name scope for X3D:
- DEF and USE correspond to XML ID/IDREF types.
- DEF must also precede any reference by USE or ROUTE, in order to support speedups inherent in single-pass scene loading.
- Prototype body scope can not be utilized outside of that given prototype (tho protos can also be nested).
- Field equivalence between a prototype interface and internal nodes (including Scripts) is accomplished via IS/connect statements.
- Inline references into another scene are exposed via EXPORT/IMPORT statements.
- Prototype names (local and external) must be unique.  Overlap with DEF names is legal but not particularly good practice due to loss of clarity.
- Script nodes can gain direct access to other nodes, live at turn time, if USE copies are passed as initial values to SFNode/MFNode fields.
- Since X3D semantics are encapsulated in a scene, they do not recognize or inhibit external names.
- X3D scenes can receive events from a variety of external sources including SAI, EAI (for VRML97) and, experimentally for future v4.0, DOM as shown by X3DOM.

Partial summary of name scope for HTML:
- HTML (non-validating) and XHTML syntax are resolved in HTML5 by common mapping to the DOM.
- DOM has many levels of event models, most pretty sophisticated and graph oriented.
- JavaScript, SVG, MathML and other languages have demonstrated interoperability.

Regarding JSON certificates, not sure what you mean.
- https certificates are handled via negotiation of an https url address.
- XML digital signature (applicable to .x3d) is controlled by XML Security mechanisms.
- JSON web signatures appear to be separately defined by IETF RFC 7515.
   https://tools.ietf.org/html/rfc7515

I would guess that application of JSON namespace IDs is a runtime activity and not something that an author would ordinarily include in a JSON-encoded X3D scene.

We will need a Security Considerations section in the forthcoming 19776-5 X3D JSON Encoding specification, so all of this exploration is helpful.



On 11/14/2015 8:25 AM, John Carlson wrote:
> Here’s a straw man for a design of namespaces for X3D JSON.  Every time an X3D JSON file is downloaded to a browser, it is assigned a unique X3D JSON namespace.  This X3D JSON namespace may be identified by a an incrementing integer, an unforgeable reference, a token, or a key, called a namespace identifier (X3D_JSON_NSID).  The X3D JSON namespace may include a certificate from the developer.  These X3D JSON namespaces may be flat, or possibly, they be nested or hierarchical (probably not recursive, but that would be interesting).  If the same X3D JSON file is loaded into a hierarchical X3D JSON namespace at the same node, then it will be given a unique X3D JSON namespace different from its siblings.  The path of X3D_JSON_NSIDs down the hierarchy will be  prepended to all DEF’s USE’s route fromNodes, route toNodes, script variables—anywhere an X3D JSON namespace is required to isolate the X3D JSON file from other X3D JSON files (can someone come up with an exhaustive list o
 f
> these)?
>
> Questions:  How are standard X3D namespaces scoped?  Is it hierarchical or flat?  How are prototypes scoped or namespaced? How do we extend X3D JSON to include certificates?  How would explicit namespaces appear in X3D or X3D JSON?  If namespaces are hierarchical, how do we privately store the namespace in DOM so the children namespaces can find the parent namespace?
>
> Has anyone thought of creating a market for the use of first downloads of X3D JSON files?  How would creating a market for X3D JSON files spur the development of X3D JSON?  How do we develop a per purchase, per download or per use pricing model with an adequate user interface which aggregates costs and creates invoices?  If developers include advertising X3D JSON files, how do they get reimbursed by advertisers?  How do we prevent an X3D JSON file from reloading itself or recursively loading itself to stop excessive costs?
>
> I am thinking I prefer flat namespaces, but I’m not familiar with how namespaces are used already in X3D.  Can we leverage something in XML namespaces?
>
> John
>> On Nov 14, 2015, at 8:53 AM, John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>>
>> If we can get Script nodes working in X3DOM (or use VRMLscript in Cobweb), we have a better chance of getting scripts working in my loader.   See:
>>
>> http://www.web3d.org/x3d/content/examples/Basic/ScriptConformance/CreateNodesJava.xhtml
>>
>> At this point, my loader is limited to what is possible in X3DOM.  We can enhance it though.   At some point my loader should be folded into X3DOM or Cobweb, when the X3D JSON standard is approved.  At this point, we’re just trying to validate the X3D JSON design.  That should include scripts, prototypes and routes, and probably have a discussion about namespaces.  Do we need to support explicit namespaces in the JSON, for example?  This would be a good subject of discussion.
>>
>> John
>>
>>> On Nov 14, 2015, at 8:21 AM, John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>>>
>>> I think Andreas has said that bringing in routes and scripts (and probably X3D prototypes) from an external JSON into an existing scene with routes and scripts would require substantial effort. See: http://sourceforge.net/p/x3dom/mailman/message/34374848/  If someone wants to architect this, I can start working on it.  I have no clue how to architect it, or how to bring it into X3DOM.  My code is very contained and does nothing really complex with namespaces.  Perhaps we need to talk to the cobweb or the x3dom developer folks.
>>>
>>> John
>>>> On Nov 14, 2015, at 7:41 AM, John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>>>>
>>>> No I haven't verified loading routes or scripts into scenes with existing routes and scenes.  Caveat emptor.
>>>>
>>>> John
>>>>
>>>> On Nov 14, 2015 7:32 AM, "John Carlson" <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>>>>
>>>>     What I can do is change the names of my functions to go along with the standard.  Most of my functions take a css selector or element and a json url or JavaScript object (parsed JSON).   The JSON is converted to X3DOM and appended to the element.  Are there standards for removing nodes?
>>>>
>>>>     On Nov 14, 2015 7:07 AM, "John Carlson" <yottzumm at gmail.com <mailto:yottzumm at gmail.com>> wrote:
>>>>
>>>>         Leonard,  Although I haven't tried loading JSON into a scene with an event, I see no reason why it wouldn't be possible. I have loaded stuff at the Scene tag level, so... We would also want to try removing items from a scene.
>>>>
>>>>         John
>>>>
>>>>         > Can X3D content be embedded in HTML, then additional content be pulled
>>>>         > in using JSON and loaded (like createX3dFromUrl)?
>>>>         >
>>>>         >
>>>>         > Leonard Daly
>>>>         >
>>>>         >
>>>>         >
>>>>         >
>>>>         > > I just added a feature to flipper.json to change Flipper?s color to
>>>>         > > green if you click on Flipper!  No changes to the loader at all!  I
>>>>         > > simply added an onclick event to the Flipper shape which does a
>>>>         > > document.querySelector() on the material element, then set?s the
>>>>         > > diffuse color attribute.   And no change necessary to the X3D JSON
>>>>         > >  encoding, although we may want to add on* events or whatever Shape
>>>>         > > accepts in X3DOM!
>>>>         > >
>>>>         > > Do a
>>>>         > >
>>>>         > > $ git pull
>>>>         > >
>>>>         > > in the X3DJSONLD folder, and reload your browser!
>>>>         > >
>>>>         > > John Carlson
>>>>         > >> On Nov 13, 2015, at 4:23 PM, John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com>
>>>>         > >> <mailto:yottzumm at gmail.com <mailto:yottzumm at gmail.com>>> wrote:
>>>>         > >>
>>>>         > >> I have added improvements to my unofficial X3D JSON to X3DOM loader.
>>>>         > >>  Please test against your X3D JSON scenes.
>>>>         > >>
>>>>         > >> Loader (and license) is at:
>>>>         > >>
>>>>         > >>https://github.com/coderextreme/X3DJSONLD
>>>>         > >>
>>>>         > >>
>>>>         > >> You can do:
>>>>         > >>
>>>>         > >> $ git clonehttps://github.com/coderextreme/X3DJSONLD
>>>>         > >>
>>>>         > >> then
>>>>         > >>
>>>>         > >> $ cd X3DJSONLD
>>>>         > >> $ unzip
>>>>         > >>http://www.web3d.org/x3d/content/examples/X3dExampleArchivesJsonScenes.zip
>>>>         > >> or actually something like:
>>>>         > >> $ unzip ~/Downloads/X3dExampleArchivesJsonScenes.zip
>>>>         > >> $ ln -swww.web3d.org/x3d/content/examples/ <http://www.web3d.org/x3d/content/examples/>
>>>>         > >> <http://www.web3d.org/x3d/content/examples/>
>>>>         > >> $ python -m SimpleHTTPServer
>>>>         > >>
>>>>         > >> You should be able to go tohttp://localhost:8000 <http://localhost:8000/>
>>>>         > >> <http://localhost:8000/> to see the loader in action.  I have moved
>>>>         > >> several large scenes to the top of the select list.
>>>>         > >>
>>>>         > >> Alternatively, instead of running python, you can run node.js,
>>>>         > >> available fromhttps://nodejs.org/
>>>>         > >>
>>>>         > >> Change config.js to point to you examples folder.
>>>>         > >>
>>>>         > >> $ npm install
>>>>         > >> $ node app.js
>>>>         > >>
>>>>         > >> Then go tohttp://localhost:3000 <http://localhost:3000/> <http://localhost:3000/> to see the
>>>>         > >> loader in action.
>>>>         > >>
>>>>         > >> Alternatively, change the name of X3DJSONLD/index.html to
>>>>         > >> X3DJSONLD.html, then copy X3DJSONLD.html, flipper.json and
>>>>         > >> X3DJSONLD.js towww.web3d.org/x3d/content/ <http://www.web3d.org/x3d/content/>
>>>>         > >> <http://www.web3d.org/x3d/content/> (beware of overwrites) and go to
>>>>         > >> web server athttp://www.web3d.org/x3d/content/X3DJSONLD.html (Don,
>>>>         > >> you can try this).  I will probably make the index.html name change
>>>>         > >> permanent at some point, but I need Don to tell me a good name that
>>>>         > >> is available for me to use under x3d/content/ (or exactly where he
>>>>         > >> wants to put the loader, if anywhere).
>>>>         > >>
>>>>         > >> If someone wants to add a typeahead search pane for the select list,
>>>>         > >> please do.  Forks and pull requests are welcome.
>>>>         > >>
>>>>         > >>
>>>>         > >> I view this code as fairly simple to review and not a large security
>>>>         > >> risk, as long as you insure that the JSON you load does not contain
>>>>         > >> security holes.  That is, watch out for embedded script tags and
>>>>         > >> other nasties.  No attempt to validate the JSON is made at this
>>>>         > >> point, so my loader will load ANY DOM found in the JSON, including
>>>>         > >> SVG, HTML, etc.  About the only thing to watch out for is the @, -
>>>>         > >> and # prefixes.  If you do want to load SVG or HTML JSON, you will
>>>>         > >> need to make sure your JSON has those prefixes.
>>>>         > >>
>>>>         > >> John
>>>>         > >>
>>>>         > >>
>>>>         > >>
>>>>         > >
>>>>         > >
>>>>         > >
>>>>         > > ------------------------------------------------------------------------------
>>>>         > >
>>>>         > >
>>>>         > > _______________________________________________
>>>>         > > X3dom-users mailing list
>>>>         > >X3dom-users at lists.sourceforge.net <mailto:X3dom-users at lists.sourceforge.net>
>>>>         > >https://lists.sourceforge.net/lists/listinfo/x3dom-users
>>>>         >
>>>>         >
>>>>         > --
>>>>         > *Leonard Daly*
>>>>         > X3D Co-Chair
>>>>         > Cloud Consultant
>>>>         > President, Daly Realism - /Creating the Future/
>>>>         > -------------- next part --------------
>>>>         > An HTML attachment was scrubbed...
>>>>         >
>>>>         > ------------------------------
>>>>         >
>>>>         > ------------------------------------------------------------------------------
>>>>         >
>>>>         >
>>>>         > ------------------------------
>>>>         >
>>>>         > _______________________________________________
>>>>         > X3dom-users mailing list
>>>>         >X3dom-users at lists.sourceforge.net <mailto:X3dom-users at lists.sourceforge.net>
>>>>         >https://lists.sourceforge.net/lists/listinfo/x3dom-users
>>>>         >
>>>>         >
>>>>         > End of X3dom-users Digest, Vol 56, Issue 7
>>>>         > ******************************************
>>>>
>>>
>>
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> x3dom-developers mailing list
> x3dom-developers at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/x3dom-developers
>


all the best, Don
-- 
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman



More information about the x3d-public mailing list