wikicite / kukulu

Draft of a data language for Wikibase
http://wikicite.org/kukulu/
Other
2 stars 0 forks source link

Define a simple subset for read-only graph traversal #4

Open nichtich opened 5 years ago

nichtich commented 5 years ago

@vrandezo pointed out the ease of LDflex, a JavaScript based DSL created by @RubenVerborgh to traverse the web of Linked Data. The implementation is uses JavaScript Proxy Objects. We could use a similar DSL to access Wikidata. In fact this would be Kukulu 1.0, the current draft (aiming at both access, query, and editing) is too complex to start with anyway.. Some examples:

var Q1 = WD.Q1 // primary query for entity Q1
Q1.label.en // "universe"
Q1.en // short form for the above? possible nameclashes?
Q1.description.en // ["Our Universe", "The Universe", "The Cosmos", "cosmos"]
Q1.P828.en // "Big bang" (could also return an array)
Q1.P282.id // "Q323" (big bang)
Q1.sitelink.dewiki // "https://de.wikiquote.org/wiki/Universum"
Q1.P1419 // special object for unknown?
Q1.claim.P1419.qualifier.P805 // access to full statement objects
Q1.P1419({ qualifier: "P805"}) // or filter lists like this? 
Q1.P2386.unit.label.en // "kilometre" (support for Wikibase data type internals!)
q.deprecatedP463 // possible shortcut for ranked claims

jQuery syntax might also give some ideas, the end we want to traverse a Wikibase graph like jQuery can be used to traverse the DOM and like LDflex can be used to traverse Linked Data.

RubenVerborgh commented 5 years ago

Hi, Ruben here, creator of LDflex. Sounds like a great idea; let me sketch some of the many possibilities below.

First of all, LDflex by itself is a generic DSL framework, located at https://github.com/RubenVerborgh/LDflex. Everything you find there is related to Linked Data, but agnostic of concrete domains.

There exist more concrete configurations, such as LDflex for Solid (at https://github.com/solid/query-ldflex/), which takes the above generic framework and configures it with a specific JSON-LD context and other extensions.

If you'd be creating an LDflex for Wikidata, you could similarly start from the generic DSL framework. Instead of the JsonLdResolver (which translates paths such as friends into http://xmlns.com/foaf/0.1/knows), you could then create a WikidataResolver that knows how do deal with Q, P, etc. You could use the built-in SPARQL serializer to then create a SPARQL query for the paths (if your goal is to reach out to the SPARQL endpoint), or to anything else.

Let me know if you want to work on this, happy to point you in the right direction.

we want to traverse a Wikibase graph like jQuery can be used to traverse the DOM and like LDflex can be used to traverse Linked Data.

It's funny that you write this, because LDflex was born out of an idea by @timbl to have "a jQuery for RDF". The different decisions that I took are to have it for Linked Data (so not really expose the RDF model) and to have the data elements as first-class citizens (as opposed to, for instance, Gremlin, where vertices and edges are first-class citizens).

RubenVerborgh commented 5 years ago

Note BTW that it doesn't have to be read-only. LDflex has write too.