Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [lyo-dev] Difference in XML /RDF vs JSON

Hi Samuel,

Thanks for the quick response. 

Regarding the second problem you can find below an example of it. The query should have returned SANDBOX-15, SANDBOX-5,SANDBOX-18 and SANDBOX-13 . 
Instead of getting each one with its attributes I get what you see below. Everything is inside 15 and the others are empty (at the last 3 lines).
<rdfs:member>

      <oslc_cm:ChangeRequest rdf:about="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-15">

        <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-02-12T16:40:16Z</dcterms:modified>

        <oslc:serviceProvider rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/serviceProviders/SANDBOX"/>

        <dcterms:title rdf:parseType="Literal">Web Service interface test</dcterms:title>

        <dcterms:identifier>SANDBOX-15</dcterms:identifier>

        <dcterms:contributor rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username="/>

        <dcterms:description rdf:parseType="Literal">null</dcterms:description>

        <sprint:clones>

          <oslc_cm:ChangeRequest rdf:about="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-13">

            <sprint:isClonedBy rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SPRINT/changeRequests/SPRINT-43"/>

            <sprint:blocks>

              <oslc_cm:ChangeRequest rdf:about="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-18">

                <dcterms:contributor rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username="/>

                <dcterms:title rdf:parseType="Literal">Web Service interface tests</dcterms:title>

                <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-12-06T12:20:27Z</dcterms:created>

                <sprint:priority>Blocker</sprint:priority>

                <dcterms:description rdf:parseType="Literal">null</dcterms:description>

                <oslc_cm:status>Open</oslc_cm:status>

                <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-02-06T17:39:20Z</dcterms:modified>

                <dcterms:identifier>SANDBOX-18</dcterms:identifier>

                <sprint:type>Bug</sprint:type>

                <sprint:environment>Platform: All, OS: All</sprint:environment>

                <oslc_cm:severity>Unclassified</oslc_cm:severity>

                <dcterms:creator rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username=admin"/>

                <sprint:isBlockedBy rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-13"/>

                <sprint:isBlockedBy rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-864"/>

                <oslc:serviceProvider rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/serviceProviders/SANDBOX"/>

              </oslc_cm:ChangeRequest>

            </sprint:blocks>

            <sprint:blocks rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-132"/>

            <oslc_cm:severity>Unclassified</oslc_cm:severity>

            <dcterms:description rdf:parseType="Literal">This is my description of this bug.</dcterms:description>

            <sprint:subtask rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-133"/>

            <sprint:subtask rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-132"/>

            <sprint:isBlockedBy rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-38"/>

            <sprint:priority>Blocker</sprint:priority>

            <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-11-22T16:54:14Z</dcterms:created>

            <sprint:type>Bug</sprint:type>

            <oslc:serviceProvider rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/serviceProviders/SANDBOX"/>

            <dcterms:identifier>SANDBOX-13</dcterms:identifier>

            <sprint:environment>Platform: PC, OS: Linux</sprint:environment>

            <sprint:isClonedBy rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-15"/>

            <sprint:duplicates>

              <oslc_cm:ChangeRequest rdf:about="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-5">

                <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-11-22T15:59:21Z</dcterms:created>

                <dcterms:identifier>SANDBOX-5</dcterms:identifier>

                <oslc_cm:status>Open</oslc_cm:status>

                <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-02-06T17:39:22Z</dcterms:modified>

                <sprint:priority>Minor</sprint:priority>

                <sprint:environment>Platform: PC, OS: Windows</sprint:environment>

                <sprint:duplicates rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-864"/>

                <sprint:type>Improvement</sprint:type>

                <dcterms:description rdf:parseType="Literal">null</dcterms:description>

                <oslc_cm:severity>Unclassified</oslc_cm:severity>

                <sprint:duplicates rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-13"/>

                <dcterms:title rdf:parseType="Literal">First Bug!!!</dcterms:title>

                <oslc:serviceProvider rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/serviceProviders/SANDBOX"/>

                <dcterms:contributor rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username="/>

                <dcterms:creator rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username=admin"/>

              </oslc_cm:ChangeRequest>

            </sprint:duplicates>

            <sprint:duplicates rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/BM/changeRequests/BM-21"/>

            <dcterms:creator>

              <foaf:Person rdf:about="http://10.1.4.10:8080/rest/api/2/user?username=mahmoud">

              </foaf:Person>

            </dcterms:creator>

            <sprint:duplicates rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-104"/>

            <dcterms:contributor rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username="/>

            <oslc_cm:status>Reopened</oslc_cm:status>

            <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2014-02-07T16:03:13Z</dcterms:modified>

          </oslc_cm:ChangeRequest>

        </sprint:clones>

        <sprint:clones rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-501"/>

        <oslc_cm:severity>Unclassified</oslc_cm:severity>

        <sprint:environment>Platform: All, OS: All</sprint:environment>

        <sprint:priority>Blocker</sprint:priority>

        <oslc_cm:status>Open</oslc_cm:status>

        <dcterms:creator rdf:resource="http://10.1.4.10:8080/rest/api/2/user?username=admin"/>

        <sprint:clones rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-864"/>

        <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2011-11-24T17:45:08Z</dcterms:created>

        <sprint:type>Bug</sprint:type>

      </oslc_cm:ChangeRequest>

    </rdfs:member>
   <rdfs:member rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-13"/>

   <rdfs:member rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-5"/>
   <rdfs:member rdf:resource="http://NB036.SWQL.local:8080/OSLC4JJira/services/SANDBOX/changeRequests/SANDBOX-18"/>
Regards,
Mohamed


2014-03-28 13:24 GMT+01:00 Samuel Padgett <spadgett@xxxxxxxxxx>:

Mohamed,

Order is not guaranteed in RDF. Even if we were to return the XML elements in the "right" order, RDF/XML parsers would not preserve it. There was some discussion in the oslc-core mailing list here:

http://open-services.net/pipermail/oslc-core_open-services.net/2011-December/001191.html

If order is important, you might use JSON or implement Arthur's proposed solution in the thread.

Sorry, I'm not clear on the second problem. Can you include the actual output you're getting and what you expect?
--
Samuel Padgett | IBM Rational | spadgett@xxxxxxxxxx
Eclipse Lyo: Enabling tool integration with OSLC


Inactive hide details for mohamed mosaad ---03/28/2014 06:34:28 AM---Here are examples to make things clearer: For first problemohamed mosaad ---03/28/2014 06:34:28 AM---Here are examples to make things clearer: For first problem  if the list contains lyo-1 to lyo-10


    From:

mohamed mosaad <m.mosaad1991@xxxxxxxxx>

    To:

Lyo project developer discussions <lyo-dev@xxxxxxxxxxx>

    Date:

03/28/2014 06:34 AM

    Subject:

Re: [lyo-dev] Difference in XML /RDF vs JSON

    Sent by:

lyo-dev-bounces@xxxxxxxxxxx




Here are examples to make things clearer:
For first problem  if the list contains lyo-1 to lyo-10 
in xml I would get: 

lyo-7
lyo-4 
lyo-1
lyo-10
.... etc

but in json I would get:

lyo-1
lyo-2
lyo-3
lyo-4
...etc

For the second problem if lets says lyo-5 has a link relates to lyo-7 then in xml i will get:
lyo-5 
 <title>:.. 
 <relates to> lyo-7: 
 title:...
lyo-3
lyo-10
lyo-7 (but with no attributes )
....

In json i will get them in order with attributes;
lyo-1
lyo-2 
...etc

Hope these examples make the problems easier to understand.

Best Regards,

Mohamed


2014-03-28 11:22 GMT+01:00 mohamed mosaad <m.mosaad1991@xxxxxxxxx>:
    Hi all,

    I noticed when I request a list in a certain order, with header with application/xml or application/rdf+xml in the header, the list returned is not in the correct order.
    However with application/json it is returned in the right order.

    Another problem is when there is a Link attribute that links one of the resources in the list to the other , the xml returned places the linked resource inside the other as if it was one of its attrbutes instead of just keeping the link as it is. This causes that some items in the list appear inside others and not as members of the list.
    Again in application/json this does not happen.

    Has anyone faced similar problems and how can I fix this?

    Best Regards,

    Mohamed Mahmoud
_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/lyo-dev



_______________________________________________
lyo-dev mailing list
lyo-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/lyo-dev


GIF image

GIF image


Back to the top