ontolog-forum
[Top] [All Lists]

Re: [ontolog-forum] fitness of XML for ontology

To: ontolog-forum@xxxxxxxxxxxxxxxx
From: John McClure <jmcclure@xxxxxxxxxxxxxx>
Date: Tue, 04 Feb 2014 11:59:29 -0800
Message-id: <52F146A1.9040804@xxxxxxxxxxxxxx>
Another drawback of JSON is that you cannot make multiple independent statements about a given URL. For instance
1. XML:  <Person rdf:about='&wiki;X" is:this=&wiki;'Y'/> and then, <Person rdf:about='&wiki;X" is:this='&wiki;Z'/> ==> OK
2. Turtle:  wiki:X is:this wiki:Y. and then, wiki:X is:this wiki:Z. ==> OK
3. JSON: { "X" :{ ...}, "X" :{...}} ==> problem: one object overwrites the other
    JSON: { "X" :{ "predicate-A": [{...}]}, "predicate-A": [{...}]}} ==> problem: one value overwrites the other

IOW the benefit of directly specifying _javascript_ objects can be outweighed by the cost of pre-processing.
/jmc

On 2/4/2014 11:15 AM, John McClure wrote:
Oops I had an extra } { in the JSON. Also, there are several _javascript_ parsers for Turtle available which do add a slight overhead, no big deal to me. Other serializations include N-triples, RDFa and N3 -- any others? As for XML serialization, there is a non-striped format (which may be the XML format JSowa loathes) which is slightly less comprehensible than the striped format. And my rendition of the striped XML format probably should've used rdf:about, not rdf:id (actually, it should've been rdf:ID if not rdf:about).

3. JSON (revised)

{ "http://www.mysemanticwiki.com/wiki/Person:X" :
  { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" :
    [ { "value" : "http://www.mysemanticwiki.com/ontology/Nouns.rdf#Person",
        "type"  : "uri"
      }
    ],
    "http://www.mysemanticwiki.com/ontology/is.rdf#this" :
    [ { "value" : "http://www.mysemanticwiki.com/wiki/Man:X",
        "type"  : "uri"
      }
    ]
  }
}


On 2/4/2014 9:54 AM, John McClure wrote:
The triple "Person:X is:this Man:X" has these encodings (from a semantic wiki that requires all its pagenames to contain a 'type' prefix). Draw your own conclusions about each encoding but to me Turtle is superior, followed by XML, and wiping up the rear would be JSON, because JSON has no text entity support unlike the other two. And so, fwiw, I think the claim JSON is a 'lightweight' protocol is somewhat unfounded plus I'm not crazy about an English-only protocol. Feel free to correct me if I've missed anything here. thanks/jmc

1. Striped RDF XML

<!ENTITY rdf   "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<!ENTITY wiki  "http://www.mysemanticwiki.com/wiki/">
<!ENTITY is    "http://www.mysemanticwiki.com/ontology/is.rdf#">
<!ENTITY nouns "http://www.mysemanticwiki.com/ontology/Nouns.rdf#">

<rdf:RDF xml:ns="&nouns;" xmlns:rdf="&rdf;" xmlns:is="&is;">
<Person rdf:id="&wiki;Person:X">
  <is:this rdf:resource="&wiki;Man:X"/>
</Person>
</rdf:RDF>

2. Turtle

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
@prefix wiki: <http://www.mysemanticwiki.com/wiki/>
@prefix is:   <http://www.mysemanticwiki.com/ontology/is.rdf#>
@prefix :     <http://www.mysemanticwiki.com/ontology/Nouns.rdf#>

wiki:Person:X
  rdf:type :Person ;
  is:this  wiki:Man:X
.

3. JSON

{ "http://www.mysemanticwiki.com/wiki/Person:X" :
  { "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" :
    [ { "value" : "http://www.mysemanticwiki.com/ontology/Nouns.rdf#Person",
        "type"  : "uri"
      }
    ]
  },
  { "http://www.mysemanticwiki.com/ontology/is.rdf#this" :
    [ { "value" : "http://www.mysemanticwiki.com/wiki/Man:X",
        "type"  : "uri"
      }
    ]
  }
}

4. Semantic Wiki (bonus!)

<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.5/">
...
<page>
  <title>Person:X</title>
  <revision>
     <text>[[rdf:type :: Person]]
           [[is:this  :: Man:X ]]
     </text>
  </revision>
</page>
</mediawiki>



_________________________________________________________________
Message Archives: http://ontolog.cim3.net/forum/ontolog-forum/  
Config Subscr: http://ontolog.cim3.net/mailman/listinfo/ontolog-forum/  
Unsubscribe: mailto:ontolog-forum-leave@xxxxxxxxxxxxxxxx
Shared Files: http://ontolog.cim3.net/file/
Community Wiki: http://ontolog.cim3.net/wiki/ 
To join: http://ontolog.cim3.net/cgi-bin/wiki.pl?WikiHomePage#nid1J    (01)

<Prev in Thread] Current Thread [Next in Thread>