json-ld / json-ld.org

JSON for Linked Data's documentation and playground site
https://json-ld.org/
Other
858 stars 152 forks source link

json-ld vs xml-ld #752

Closed Friedrich777 closed 3 years ago

Friedrich777 commented 3 years ago

Dear developers, please develop XML-LD, then the world of web technologies will come to order. You are well aware that XSD technology solves all problems to avoid mistakes. And as a developer, it will be convenient for me to create an XSD schema and be happy. Thanks in advance Friedrich

Friedrich777 commented 3 years ago
<?xml version="1.0" encoding="UTF-8"?>
<ld:xml xmlns:ld="https://xml-ld.org/" xmlns:s="http://schema.org/">
  <ld:context>http://schema.org</ld:context>
  <ld:type>NewsArticle</ld:type>
  <s:mainEntityOfPage>
      <ld:type>WebPage</ld:type>
      <ld:id>https://viziya.info/tochka-zreniya/politika/protesty-ugrozhayut-obshchestvu-uvereny-v-partii-sluga-naroda.html</ld:id>
  </s:mainEntityOfPage>
  <s:headline>Протесты угрожают обществу, уверены в партии «Слуга Народа»</s:headline>
  <s:alternativeHeadline>Протесты под ОП могут обернуться войной между СБУ и МВД</s:alternativeHeadline>
  <s:image>
      <ld:type>ImageObject</ld:type>
      <s:url>https://viziya.info/pic/2021/03/1599.jpg</s:url>
  </s:image>
  <s:datePublished>2021-03-22T17:58:34+02:00</s:datePublished>
  <s:dateModified>2021-03-22T17:58:34+02:00</s:dateModified>
  <s:author>
      <ld:type>Person</ld:type>
      <s:name>Всеволод Гордиенко</s:name>
  </s:author>
  <s:publisher>
      <ld:type>Organization</ld:type>
      <s:name>Визия</s:name>
      <s:brand>ВизиЯ</s:brand>
      <s:alternateName>Viziya</s:alternateName>
      <s:logo>
          <ld:type>ImageObject</ld:type>
          <s:url>https://viziya.info/img/slogo.png</s:url>
          <s:width>212</s:width>
          <s:height>60</s:height>
      </s:logo>
  </s:publisher>
</ld:xml>
pchampin commented 3 years ago

If you want to serialize Linked Data in XML, why not simply use RDF/XML ?

melvincarvalho commented 3 years ago

Depending on your use case id suggest using RDF/XML as @pchampin points out

However, most of the Linked Data community is desperately trying to get away from RDF/XML and moving to JSON-LD. RDF/XML is considered legacy by many and a failed experiment, with certain niche use cases in the enterprise

Most people I know that have used RDF/XML found it to be a terrible dev experience. RDF is also becoming even more complex with RDF* which does not currently map to JSON-LD

There are other things that dont map 100% between the two serializations such at the @context variable

IMHO XML doesnt belong in the JSON-LD playground and would be better as a separate site, or separate team

gkellogg commented 3 years ago

RDF is also becoming even more complex with RDF* which does not currently map to JSON-LD

FYI, see json-ld.github.io/json-ld-star.

bertvannuffelen commented 2 years ago

Even it is closed I like to add some notes for the XML community:

RDF/XML is a serialization of the RDF graph into XML. For that reason there is no fixed business-oriented XSD possible. It is just a technical sound serialization. And for that reason the only valid advice to XML developers is not to use RDF/XML as the basis for development. Your basic assumptions on stability/verification/etc. will not work. I would not call it a "failed experiment". But the naive expectation that this is the bridge between the XML community and the Semantic Web community will be very disappointing. So better don't try it. (Even more: there are fundamental differences between qNames in XML and RDF).

On the request for XML-ld, that is something for which I hear a lot of support in governments. They use XML data exchanges which should align with the semantics, expressed as a semantic model. There is no need for them to switch to json-serialization data exchanges (a change just for spending money is not very encouraged ;-). But there is a need to ensure that the XML content aligns with the semantic model. For that XML-ld mapping approach would be great. Today everybody has to develop their own mapping approach. Standardizing this will bridge it.

But I agree this is not the objective of this working group. It should be initiated by the XML community. Suggestion, maybe this should be requested at https://www.w3.org/XML/EXI/.

pchampin commented 2 years ago

Another effort is this direction was GRDDL but I am not sure how much it is still used (and implemented) nowadays.

gkellogg commented 2 years ago

As JSON-LD algorithms are defined in terms of an internal representation many different serialization formats could be used (YAML and CBOR described as examples). Conceivably, XML could as well, although the use of namespaces in XML, and term definitions used as namespaces in JSON-LD contexts overlap, and could naively lead to incorrect XML. But, getting into XML brings up many issues.

Another place to look might be RDFa. Part of the test suite works over RDFa in XML. Although it's intended for HTML, it can work in other similar SGML-derived formats.

niklasl commented 2 years ago

A long time ago (when I regularly worked with XML alongside RDF), I drafted a replacement for RDF/XML, called Grit ("Grokkable RDF Is Transformable"). That was on Google Code, but I exported that to Github when that closed down. (the XSLT implementation is at: https://github.com/oort/oort/blob/master/impl/xslt/grit/rdfxml-grit.xslt and the GRDDL back to RDF/XML is at: https://github.com/oort/oort/blob/master/impl/xslt/grit/grit-grddl.xslt .)

(I would probably still recommend that kind of approach over attempting the JSON-LD design in XML without leveraging XML namespaces, although I can see why e.g. type coercion would be attractive. Also, the Grit design expected the default namespace to be the null namespace, so it would need an overhaul to support the nowadays common practise of default vocabularies.)