Wikidata:Property proposal/serves resource

From Wikidata
Jump to navigation Jump to search

serves resource

[edit]

Originally proposed at Wikidata:Property proposal/Generic

   On hold
Descriptionresource served by the subject; unless otherwise qualified with protocol (P2700) the protocol is derived from instance of (P31) (e.g. HTTP for instances of website (Q35127))
Data typeItem
Domaindata item instance of website (Q35127), web application (Q189210), web user interface (Q1981057) or web API (Q557770) (other classes can be added as needed, this constraint is just to allow for efficient inferring of the default protocol)
Example 1
Example 2
Example 3

Motivation

[edit]

This proposal seeks to introduce a way to model the HTTP routes of web interfaces (be they web user interfaces or web APIs).

The semantics of HTTP routes are very much of interest for:

  • web search engines which want to understand the function of a particular web page
  • web crawlers which want to crawl the web for resources of a specific type, or want to avoid crawling resources of a specific type, or want to crawl resources of a specific type more/less frequently than resources of another specific type
  • hyperlinking, creating a hyperlink to a specific resource within a specific context
    • this enables other useful properties e.g. adding references to git commits only via their commit hash, see Wikidata:Property proposal/changeset
    • this enables very useful userscripts e.g. you could have a button that automatically takes you to the API endpoint for the specific resource you're currently viewing
  • evaluating compatibility between web interfaces
  • providing compatibility e.g. if you self-host a cgit (Q28974765) instance but decide that you want to switch to a self-hosted GitLab (Q16639197) instance. If the semantics of their most important routes were modeled in Wikidata, there could be a script that automatically generates an nginx (Q306144) config for you to provide server-side redirects from the old cgit routes to the GitLab routes (or vice versa if you were to switch in the opposite direction)

Description

[edit]

To achieve that this proposal proposes one property for data items and three accompanying qualifer-only properties.

The core idea is that URL suffix formatter can be used to qualify under which URL suffix the resource is served, as with formatter URL (P1630) $1 can be replaced with the identifier of the resource.

Since resources are often hierarchical we also introduce a parent resource qualifier with the following semantics:

  • Xserves resourceappleURL suffix formatter/apples/$1
  • Xserves resourceorangeURL suffix formatter/oranges/$1parent resourceapple

means that oranges are served at /apples/$appleId/oranges/$orangeId.

Our system is already powerful enough to model the majority of HTTP routes of many web interfaces, however there are two things we currently do not cover:

  • some HTTP routes cannot modeled in this way, e.g. imagine that the route instead was /apples/$orangeId/$appleId
  • some resources have multiple kinds of identifiers (e.g. a Phabricator project has a slug (Q99601940) as well as a numeric identifier (Q93868746))

We can address both concerns by introducing a fourth and last qualifying property "URL parameter", with the following semantics:

The names of the placeholders do not matter, what matters is that they are in the same order as the "URL parameter" qualifiers.

Cheers, Push-f (talk) 00:21, 21 November 2022 (UTC)[reply]

Discussion

[edit]
  • WikiProject Informatics has more than 50 participants and couldn't be pinged. Please post on the WikiProject's talk page instead. Notified participants of WikiProject Websites. --Push-f (talk) 00:33, 21 November 2022 (UTC)[reply]
  •  Support, great proposal. I do wonder if we're stretching the limits of what Wikidata can represent, especially when it comes to the ability of human editors to build the knowledge subgraphs when modeled to such detail and complexity. This should not be a blocker for adopting this proposal, mind you, but we should probably consider having detailed examples and maybe even a diagram or two to help editors understand how these properties are meant to be used. Otherwise we may end up with a situation similar to the modeling of books which is famously inconsistent in Wikidata as it clashes with people's intuition about what a book is.  – The preceding unsigned comment was added by Waldyrious (talk • contribs).
    Thanks! Yes I agree about these properties needing thorough documentation; on top of that I will probably develop a user script to view the routes implied by the proposed properties :) --Push-f (talk) 09:40, 21 November 2022 (UTC)[reply]
  •  Comment Very solid and thoughtful proposal. However, your examples show that storing this information in Wikidata and consuming it can be kinda awkward. Consider creating your own specialized database that we can link to from Wikidata ;) Dexxor (talk) 17:52, 22 November 2022 (UTC)[reply]
    Thanks :) Wikibase isn't easy to self-host[1] and this is without getting into setting up a Blazegraph (Q20127748) server so that you can still query the data with SPARQL and setting up some third-party login to lower the barrier to entry ... but even then I think people are more likely to contribute to Wikidata than some niche database.
    Besides with the right tooling I think this proposal could really address a fundamental problem of Wikidata, which is that we don't want to create a bunch of properties for every website/common HTTP route out there. Have you looked at my changeset proposal? There @Dexxor: argued that "changeset formatter URL suffix" is too specific, so I withdrew that idea in favor of this more reusable and powerful approach. I guess another example is also my Wikimedia Phabricator project proposal where @Arlo Barnes: has argued that a more general property would be better.
    So I think the solution is to develop specialized tooling for these properties in Wikidata (e.g. user scripts for contributors and libraries/bots for consumers), rather than outsourcing that data somewhere else entirely.
    --Push-f (talk) 10:00, 23 November 2022 (UTC)[reply]
  • On hold Apparently qualifiers of data type item are unordered, so the "URL parameter" idea doesn't work. The best alternative I can think of would be encoding the parameter class IDs directly into the URL suffix formatter, e.g. ${Q6} ... however encoding item IDs into string obviously isn't ideal. --Push-f (talk) 02:30, 27 November 2022 (UTC)[reply]

URL suffix formatter

[edit]

Originally proposed at Wikidata:Property proposal/Generic

   On hold
Description(qualifier only) under which URL suffix the resource is served; "$1" can be automatically replaced with the identifier of the resource; if the template requires additional parameters they may be specified as other placeholders matching the regular expression \$[a-z]+, in this case the data types of the parameters must be qualified with "URL parameter"
Data typeString
Domainmay only be used as a qualifier for "serves resource"
Example 1see #serves resource
Example 2see #serves resource
Example 3see #serves resource
See alsoformatter URL (P1630)

See #serves resource for the motivation and discussion.

parent resource

[edit]

Originally proposed at Wikidata:Property proposal/Generic

   On hold
Description(qualifier only) indicates that this resource is a subresource of the given resource (and that the "URL suffix formatter" of the given resource comes before the "URL suffix formatter" of this resource)
Data typeItem
Domainmay only be used as a qualifier for "serves resource"
Example 1see #serves resource
Example 2see #serves resource
Example 3see #serves resource

See #serves resource for the motivation and discussion.

URL parameter

[edit]

Originally proposed at Wikidata:Property proposal/Generic

   On hold
Description(qualifier only) meant to qualify the data types of placeholders in "URL suffix formatter" values; if there are several URL parameters this qualifier must be specified multiple times in the same order that the URL parameter placeholders appear in the "URL suffix formatter" value
Data typeItem
Domainmay only be used as a qualifier for "serves resource"
Example 1see #serves resource
Example 2see #serves resource
Example 3see #serves resource

See #serves resource for the motivation and discussion.