|
| 1 | +title: RDFa Plugin for WordPress |
| 2 | +--- |
| 3 | +categories: |
| 4 | +open-source |
| 5 | +gsoc-2009 |
| 6 | +--- |
| 7 | +author: dinishi |
| 8 | +--- |
| 9 | +pub_date: 2009-07-15 |
| 10 | +--- |
| 11 | +body: |
| 12 | + |
| 13 | +Creative Commons provides vast number of public copyright licenses for people who want to enable free distribution of their work. Creative Commons licenses currently covers over **1.6 billion resources**. These license files are then translated to multiple different languages and ported for [different jurisdictions](https://wiki.creativecommons.org/wiki/CC_Ports_by_Jurisdiction) for international usage. People link to the respective licenses along with their licensed works. These license files are in the form of `html` files, stored in [creativecommons/creativecommons.org](https://github.com/creativecommons/creativecommons.org/tree/master/docroot/legalcode) repo. |
| 14 | + |
| 15 | +### Problem Statement |
| 16 | +Conversion of information to a format compatible with RDF is a cumbersome endeavor. Though a complete automation of the conversion process would be a goal which is hard to achieve it can be made lot simpler with a wordpress plug-in. The plug-in will enable the users to convert a generic HTML in to a RDF compatible format with ease. |
| 17 | + |
| 18 | +### Overview |
| 19 | +External Data is an extension to MediaWiki that allows for retrieving data |
| 20 | +from various sources: external URLs and local wiki pages (in CSV, JSON and |
| 21 | +XML formats), database tables, and LDAP servers |
| 22 | + |
| 23 | +The extension defines five parser functions - #get_external_data, |
| 24 | +get_db_data, #get_ldap_data, #external_value and #for_external_table: |
| 25 | + |
| 26 | +`get_external_data retrieves the data from a URL that holds XML, CSV or |
| 27 | +JSON, and assigns it to local variables or arrays.` |
| 28 | + |
| 29 | +`get_db_data retrieves data from a database, using a SQL query, and assigns |
| 30 | +it to local variables or arrays.` |
| 31 | + |
| 32 | +`get_ldap_data retrieves data from an LDAP server and assigns it to |
| 33 | +local variables.` |
| 34 | + |
| 35 | +`external_value displays the value of any retrieved variable, or the |
| 36 | +first value if it's an array.` |
| 37 | + |
| 38 | +`for_external_table applies processing onto multiple rows retrieved by |
| 39 | +get_external_data.` |
| 40 | + |
| 41 | +In addition, the extension defines a new special page, 'GetData', that |
| 42 | +exports selected rows from a wiki page that holds CSV data, in a format that |
| 43 | +is readable by #get_external_data. |
| 44 | + |
| 45 | +For more information, see the extension homepage at: |
| 46 | +[RDFa](http://www.mediawiki.org/wiki/Extension:External_Data) |
| 47 | + |
| 48 | + |
| 49 | +### Requirements |
| 50 | +This version of the External Data extension requires MediaWiki 1.8 or higher. |
| 51 | + |
| 52 | +### Installation |
| 53 | + |
| 54 | +To install the extension, place the entire 'ExternalData' directory |
| 55 | +within your MediaWiki 'extensions' directory, then add the following |
| 56 | +line to your 'LocalSettings.php' file: |
| 57 | + |
| 58 | +`require_once( "$IP/extensions/ExternalData/ExternalData.php" );` |
| 59 | + |
| 60 | +To cache the data from the URLs being accessed, you can call the contents |
| 61 | +of ExternalData.sql in your database, then add the following to |
| 62 | +LocalSettings.php: |
| 63 | + |
| 64 | + `$edgCacheTable = 'ed_url_cache';` |
| 65 | + |
| 66 | +You should also add a line like the following, to set the expiration time |
| 67 | +of the cache, in seconds; this line will cache data for a week: |
| 68 | + |
| 69 | + `$edgCacheExpireTime = 7 * 24 * 60 * 60;` |
| 70 | + |
| 71 | +You can also set for string replacements to be done on the URLs you call, |
| 72 | +for instance to hide API keys: |
| 73 | + |
| 74 | + `$edgStringReplacements['MY_API_KEY'] = 'abcd1324';` |
| 75 | + |
| 76 | +You can create a "whitelist" to allow retrieval of data only from trusted |
| 77 | +sites, in the manner of MediaWiki's $wgAllowExternalImagesFrom - if you |
| 78 | +are hiding API keys, it is very much recommended to create such a |
| 79 | +whitelist, to prevent users from being able to discover theire values: |
| 80 | + |
| 81 | + |
| 82 | +Finally, to use the database or LDAP retrieval capabilities, you need to |
| 83 | +set connection settings as well - see the online documentation for more |
| 84 | +information. |
| 85 | + |
| 86 | + |
| 87 | +CC RDFa Plugin for WordPress is only possible due to the support and guidance of my mentors [Nathan Yergler](https://github.com/nyergler) and `CC Tech Staff Member`, who have been very supportive on every step of the project. Also I would like to thank engineering director [Kriti Godey](https://creativecommons.org/author/kgodey) for her continuous support. |
| 88 | + |
| 89 | +You can follow the project on Github: [cc-archive/ExternalData_RDFa](https://github.com/cc-archive/ExternalData_RDFa). |
| 90 | + |
| 91 | +The project is approaching its completion. Can't wait to see it in production. |
| 92 | + |
| 93 | +*Signing off |
| 94 | +Dinishika Weerarathna* |
0 commit comments