On Dienstag, 28. Juli 2009, Daniel Friesen wrote: > I recently noticed the JSON support in Semantic MediaWiki. > Gave me interesting thoughts, as it could be a very powerful way to > connect wiki data to on-wiki JavaScript tools.
Good. I forward to Fabian, who is the main person behind the JSON export. > > However I have to notes. > > In addition to json support on Special:Ask and in #ask queries, could we > also support some sort of Special:ExportJSON. ie: Like how ExportRDF > exports single page rdf files with the semantic data, export single page > json of all the properties on that page. Yes, that could be done. I fear that the RDF export code is not really generic for allowing different export types easily. This part could really use some proper re-engineering (another RDF-specific feature, bulk export to file, would also be a nice option for other export formats!). I am not sure when I could do that, support is welcome! This should be combined with the pending rewrite of the printer interfaces. Currently one could not make an RDF format that behaves like the RDF export because this would require to query for *all* properties of a page. A better architecture could enable this. > > Also, the json being outputted is invalid. (At least from what I get on > Wikia, I don't know about trunk): > Doing an #ask format=json on yugioh.wikia's Dark Magician for ?English > Name, ?ATK, and ?DEF gives me this. > { > properties: { > "english_name" : { valueType: "text" }, > "atk" : { valueType: "number" }, > "def" : { valueType: "number" } > }, > items: [ > { > label: "Dark Magician", > "english_name": "Dark Magician", > "atk": 2500, > "def": 2100, > "uri" : "http://yugioh.wikia.com/index.php?title=Dark Magician" > } > ] > } > > In JSON ALL keys MUST be wrapped with DOUBLE quotes. the properties: > valueType: items: and label: listed there are all invalid because they > are not wrapped in double quotes. > All valid JSON parsers will reject the json outputted by SMW. The JSON was engineered to be accepted by Exhibit, so this may be the reason for this peculiarity. I hope Fabian can comment on this. It might also be fixed: I recently updated the JSON export with some input that Fabian sent me. > > Also, wouldn't it be a good idea to at least note that we're modifying > the keys that the query asked for? Something like a "normalized": { > "English Name": "english_name", "ATK": "atk", "DEF", "def" }, at the top. Yes, I agree. Of course, it is a general problem of JSON that the keys are somewhat over-simple here to really identify a property globally (e.g. when merging data from various sources). This is where RDF has its advantages. Regards, Markus -- Markus Krötzsch Semantic MediaWiki http://semantic-mediawiki.org http://korrekt.org mar...@semantic-mediawiki.org
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Semediawiki-devel mailing list Semediawiki-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/semediawiki-devel