Fruits semantic data

From Discourse DB
Jump to navigation Jump to search

This is a demonstration of how to retrieve a two-dimensional array of data from an external source, then store it semantically for querying. Here, data is first retrieved from the "fruits data" page, using the #get_web_data call from the External Data extension, and then stored as "subobjects", using the #store_external_table call in External Data. (If a version of Semantic MediaWiki before 1.8 were being used, #store_external_table would also require the presence of the Semantic Internal Objects extension).

Error: Semantic MediaWiki must be installed in order to call #store_external_table.

Here are the results of a query to retrieve that data again.

{{#ask:Is fruit in::+|? Has name|? Has color|? Has shape|mainlabel=-}}

Note that this a contrived example - for the case of fruits, you'd almost definitely want to have a different page for each fruit, using the more conventional #external_value calls. But for data that makes sense to be stored (not just displayed) as a table, this is the way to go.

See also[edit | edit source]