Editing Using the COPTR data feed

Jump to navigation Jump to search

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.

Latest revision Your text
Line 12: Line 12:
  
 
== The COPTR API ==
 
== The COPTR API ==
As COPTR is based on MediaWiki, you can access the COPTR content via the MediaWiki API. The [https://www.mediawiki.org/wiki/API:Main_page Official MediaWiki API Documentation] is a pretty good starting point, and [http://coptr.digipres.org/api.php the endpoint itself is ''fairly'' self-documenting]. You can also use the [[Special:ApiSandbox|API sandbox]] to experiment with the API. However, to help get you started, here are a couple of examples.
+
As COPTR is based on MediaWiki, you can access the COPTR content via the MediaWiki API. The [https://www.mediawiki.org/wiki/API:Main_page Official MediaWiki API Documentation] is a pretty good starting point, and [http://coptr.digipres.org/api.php the endpoint itself is ''fairly'' self-documenting]. However, to help get you started, here are a couple of examples.
  
 
=== Machine-Readable Recent Changes ===
 
=== Machine-Readable Recent Changes ===
Line 18: Line 18:
 
If you want access to information on what has changed recently, just like the [[Special:RecentChanges|RecentChanges]] page, but in a machine-readable form, you can construct a URL like this:
 
If you want access to information on what has changed recently, just like the [[Special:RecentChanges|RecentChanges]] page, but in a machine-readable form, you can construct a URL like this:
  
https://coptr.digipres.org/api.php?action=query&list=recentchanges&format=json&rclimit=500&rctype=new&rcprop=title%7Cids%7Csizes%7Cflags%7Cuser%7Ctimestamp
+
http://coptr.digipres.org/api.php?action=query&list=recentchanges&format=json&rclimit=500&rctype=new&rcprop=title%7Cids%7Csizes%7Cflags%7Cuser%7Ctimestamp
  
 
Breaking down those query parameters, we have:
 
Breaking down those query parameters, we have:
Line 59: Line 59:
 
* [http://coptr.digipres.org/api.php?action=query&list=categorymembers&cmtitle=Category:Function&cmtype=subcat&cmlimit=500&format=xml This query lists all the subcategories belonging to the Function category].
 
* [http://coptr.digipres.org/api.php?action=query&list=categorymembers&cmtitle=Category:Function&cmtype=subcat&cmlimit=500&format=xml This query lists all the subcategories belonging to the Function category].
 
* [http://coptr.digipres.org/api.php?action=query&list=categorymembers&cmtitle=Category:Fixity&cmtype=page&cmlimit=500&format=xml This query lists the Page IDs and Title of all the pages belonging to the Fixity category].
 
* [http://coptr.digipres.org/api.php?action=query&list=categorymembers&cmtitle=Category:Fixity&cmtype=page&cmlimit=500&format=xml This query lists the Page IDs and Title of all the pages belonging to the Fixity category].
 
=== Semantic API modules ===
 
COPTR runs the [https://www.semantic-mediawiki.org Semantic MediaWiki] extension, which provides [https://www.semantic-mediawiki.org/wiki/Help:API semantic API modules] that can be used to query the COPTR data. For instance, the following URL uses the ''ask'' module to query for all tools that have function ''Rendering'' and content type ''Container'', and retrieves the tools' purpose:
 
 
[https://coptr.digipres.org/api.php?action=ask&query={{urlencode:[[Category:Tools]][[Function::Rendering]][[Content::Container]]}}|%3FPurpose <nowiki>https://coptr.digipres.org/api.php?action=ask&query=[[Category:Tools]][[Function::Rendering]][[Content::Container]]|%3FPurpose</nowiki>]
 
 
The following properties (some of which may be empty for some tools) can be queried
 
{| class="wikitable" style="margin: 0 auto;"
 
! Property
 
! Meaning
 
|-
 
| [[Property:Purpose|Purpose]]
 
| A brief description of the tool's purpose
 
|-
 
| [[Property:License|License]]
 
| Information about the tool's license
 
|-
 
| [[Property:Cost|Cost]]
 
| Information about the cost of the tool
 
|-
 
| [[Property:Platforms|Platforms]]
 
| A description of the platform(s) that the tool runs on
 
|-
 
| [[Property:Input format|Input format]]
 
| The input format(s) that the tool supports
 
|-
 
| [[Property:Output format|Output format]]
 
| The output format(s) that the tool supports
 
|-
 
| [[Property:Function|Function]]
 
| The function(s) of the tool
 
|-
 
| [[Property:Content|Content]]
 
| The tool's content type(s)
 
|}
 
 
The Input and Output formats also have queryable properties
 
{| class="wikitable" style="margin: 0 auto;"
 
! Property
 
! Meaning
 
|-
 
| [[Property:Wikidata ID|Wikidata ID]]
 
| The identifier of the file format in [https://www.wikidata.org Wikidata]
 
|-
 
| [[Property:File formats wiki ID|File formats wiki ID]]
 
| The identifier of the file format in the [[formats:Main Page|File formats wiki]]
 
|}
 
 
You can use the [[Special:Ask|Semantic search]] interface to construct and test a query that can subsequently be used with the ask API module. For more information about the query syntax and more advanced query constructs - such as property chaining and inverse queries - please refer to the Semantic MediaWiki documentation on [https://www.semantic-mediawiki.org/wiki/Help:Selecting_pages selecting pages] and [https://www.semantic-mediawiki.org/wiki/Help:Displaying_information displaying information].
 
  
 
== The COPTR Database Backup Dumps ==
 
== The COPTR Database Backup Dumps ==
 
We also make daily XML dumps available, for backup and re-use purposes. You can find them in the [http://coptr.digipres.org/backup-dumps/ backup-dumps] folder,
 
We also make daily XML dumps available, for backup and re-use purposes. You can find them in the [http://coptr.digipres.org/backup-dumps/ backup-dumps] folder,

Please note that all contributions to COPTR are considered to be released under the Attribution-ShareAlike 3.0 Unported (see COPTR:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)