On 27.11.2015 07:21, Christopher Johnson wrote:
Hi,
After looking at the RDF format closely, I am asking if the item,
statement and reference IRIs could/should be directly resolvable to
XML/JSON formatted resources.
It seems that currently
http://www.wikidata.org/entity/.... redirects to
the UI at
https://www.wikidata.org/wiki/ which is not what a machine
reader would expect.
This interface actually supports content negotiation. If you open it in
a browser, it redirects to HTML, but an RDF client can request RDF and
will get this. There is no RDF/JSON export AFAIK (maybe it was a typo
above?).
It may also be that auxiliary nodes (such as statements and references)
do not resolve, but resolving the items will always return enough RDF
context to get all data. Resolving statements would be easy by mapping
them to the item data (returning more data is always ok in RDF). This is
possible since the statement IDs are prefixed by the item id. For
references, it might be harder to implement this, since you cannot
reverse the hash to find the item. This might remain open for a while,
since it is more implementation effort.
Without a simple method to resolve the IRIs (perhaps a
RESTful API?),
these RDF data objects are opaque for parsers.
Of course, with wbgetclaims, it is possible to get the statement like this:
https://www.wikidata.org/w/api.php?action=wbgetclaims&format=xml&cl…
but the API expected GUID format does not match the RDF UUID
representation (there is a $ or "%24" after the item instead of a -) and
it returns both the statement and the references.
Yes, using the MediaWiki API will not be a suitable alternative to
getting linked RDF. Let's not go into this.
Since the reference is its own node in the RDF, it can be queried
independently. For example, to ask "return all of the statements where
reference R is bound." But then, the return value is a list of
statement IDs and a subquery or separate query is then required to
return the associated statement node.
Yes, resolving statement ids has some utility. I hope it works already.
Otherwise it can be made to work without too much effort.
As a temporary workaround for all of this, note that the SPARQL endpoint
can be (ab)used as a linked data source to fetch data for any IRI
present in the data.
I am also wondering why item, statement and reference "UUIDs" are not in
canonical format in the RDF. This is a question of compliance with IETF
guidelines, which may or may not be relevant.
Item: Q20913766
Statement: Q20913766-CD281698-E1D0-43A1-BEEA-E2A60E5A88F1
Reference: 39f3ce979f9d84a0ebf09abe1702bf22326695e9
See:
https://www.mediawiki.org/wiki/Wikibase/Indexing/RDF_Dump_Format
See:
http://www.iana.org/assignments/urn-namespaces/urn-namespaces.xhtml
and
http://tools.ietf.org/html/rfc4122 for information on urn:uuid
guidelines.
The IDs used in RDF are simply the ids used in the database. The RDF
export is not aware of the concept of UUID that was an inspiration (but
apparently not an exact model) for the way in which the database is
generating its ids. If Wikibase internally switches to canonical UUIDs,
this will directly show in the RDF.
Best regards,
Markus
Thanks for your feedback,
Christopher
_______________________________________________
Wikidata-tech mailing list
Wikidata-tech(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech