Re: ANN: XML Schema to JSON Schema XQuery transform

If you look at the JSON Schema website, you will see that it has been in development since 2008 and does have a number of implementers.

I was also told about JSON-LD https://json-ld.org/ <https://json-ld.org/>

> On Dec 22, 2017, at 8:38 AM, Pete Cordell <petexmldev@codalogic.com> wrote:
> 
> On that topic, some of us are working on something called JSON Content Rules (JCR).  More details at:
> 
>  http://json-content-rules.org <http://json-content-rules.org/>
> 
> Pete.
> -- 
> ---------------------------------------------------------------------
> Pete Cordell
> Codalogic Ltd
> C++ tools for C++ programmers, http://codalogic.com <http://codalogic.com/>
> Read & write XML in C++, http://www.xml2cpp.com <http://www.xml2cpp.com/>
> ---------------------------------------------------------------------
> On 22/12/2017 05:02, Mukul Gandhi wrote:
>> Thanks, for your reply.
>> I thought that JSON didn't had a standard for its schema representation. What standard for JSON, are you complying with?
>> On 19 December 2017 at 00:04, Loren Cahlander <loren.cahlander@gmail.com <mailto:loren.cahlander@gmail.com> <mailto:loren.cahlander@gmail.com <mailto:loren.cahlander@gmail.com>>> wrote:
>>    The library module relies on XQuery 3.1 due to the use of maps.
>>    It can be used in MarkLogic with the version of ML that incorporates
>>    maps.
>>    It can also be run in eXist-db.
>>    To run this from the command line would be:
>>    java -cp saxon9ee.jar net.sf.saxon.Query -q:load-xsd.xqy
>>    -s:schema2translate.xsd -o:translated-schema.json
>>    NOTE:
>>    I have also added a flag for preserving namespace prefixes in the
>>    JSON Schema
>>    Create an XQuery file called load-xsd.xqy with the following:
>>        xquery version "3.1";
>>        import module namespace
>>        xsd2json="http://easymetahub.com/ns/xsd2json <http://easymetahub.com/ns/xsd2json>
>>        <http://easymetahub.com/ns/xsd2json <http://easymetahub.com/ns/xsd2json>>" at "xsd2json.xqy";
>>        declare namespace map =
>>        "http://www.w3.org/2005/xpath-functions/map <http://www.w3.org/2005/xpath-functions/map>
>>        <http://www.w3.org/2005/xpath-functions/map <http://www.w3.org/2005/xpath-functions/map>>";
>>        declare namespace output =
>>        "http://www.w3.org/2010/xslt-xquery-serialization <http://www.w3.org/2010/xslt-xquery-serialization>
>>        <http://www.w3.org/2010/xslt-xquery-serialization <http://www.w3.org/2010/xslt-xquery-serialization>>";
>>        declare namespace xs="http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>
>>        <http://www.w3.org/2001/XMLSchema <http://www.w3.org/2001/XMLSchema>>";
>>        declare option output:method "json";
>>        declare option output:indent "yes";
>>        xsd2json:run(.//xs:schema, map { ‘keepNamespace’: Fn:true() } )
>>>    On Dec 15, 2017, at 1:36 AM, Mukul Gandhi <gandhi.mukul@gmail.com <mailto:gandhi.mukul@gmail.com>
>>>    <mailto:gandhi.mukul@gmail.com <mailto:gandhi.mukul@gmail.com>>> wrote:
>>> 
>>>    I'm trying to run the utility you've created.
>>> 
>>>    Can you please let me know the command line for same (for e.g,
>>>    XQueryProcessor <arguments>)?
>>> 
>>>    On 14 December 2017 at 02:21, Loren Cahlander
>>>    <loren.cahlander@gmail.com <mailto:loren.cahlander@gmail.com> <mailto:loren.cahlander@gmail.com <mailto:loren.cahlander@gmail.com>>> wrote:
>>> 
>>>        Hello folks,
>>> 
>>>        I have started the creation of an XML Schema to JSON Schema
>>>        transform written in XQuery.  I would appreciate the reporting
>>>        of any issues that you find and any suggestions that you may
>>>        have for the codebase.
>>> 
>>>        One question that I received today is how am I handling
>>>        namespaces.  The script, currently, strips out the
>>>        namespaces.  One suggestion was to put the prefix in the
>>>        property’s name.
>>> 
>>>        I am figuring that I will need to add the passing of options
>>>        to the process.  Suggestions of options to control the
>>>        transform are also appreciated.
>>> 
>>>        It is a work in progress.
>>> 
>>>        https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2 <https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2>
>>>        <https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2 <https://gist.github.com/lcahlander/0eecf499dfe307d7aecbb15f775bd4f2>>
>>> 
>>>        Thank you,
>>> 
>>>        Loren Cahlander
>>> 
>> -- 
>> Regards,
>> Mukul Gandhi

Received on Friday, 22 December 2017 15:05:40 UTC