-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
define a schema for relation members #174
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,8 +126,88 @@ | |
} | ||
}, | ||
"additionalProperties": false | ||
}, | ||
"relation": { | ||
"$ref": "#/$defs/RelationSchema" | ||
}, | ||
"relationCrossReference": { | ||
"description": "A preset can reference the relation schema from another preset", | ||
"type": "string", | ||
"pattern": "^\\{.+\\}$" | ||
} | ||
}, | ||
"additionalProperties": false, | ||
"required": ["name", "geometry", "tags"] | ||
"required": ["name", "geometry", "tags"], | ||
"$defs": { | ||
"RelationSchema": { | ||
"type": "object", | ||
"properties": { | ||
"optionalTags": { | ||
"type": "object", | ||
"description": "Only useful for specifying placeholders which are referenced in members.*.matchTags", | ||
"examples": [{ "route": "$1" }], | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"id": { | ||
"type": "string", | ||
"description": "The “permanent relation type ID”, this should match the value of https://osm.wiki/Property:P41 in the OSM wiki’s wikibase system." | ||
}, | ||
"allowDuplicateMembers": { | ||
"type": "boolean", | ||
"default": true | ||
}, | ||
"members": { | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"roles": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
}, | ||
"description": "Map of roles to their label in the default language. An empty string is allowed as key." | ||
}, | ||
"geometry": { | ||
"type": "array", | ||
"items": { | ||
"$ref": "field.json#/$defs/Geometry" | ||
}, | ||
"description": "If not specified, any geometry is allowed" | ||
}, | ||
"matchTags": { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be useful to define something for documentation here too? It would be nice to be able to show a tooltip with a description of the role, for example to clarify that “Capital” ( The wiki has a number of data items about roles, but none of them are tied to article titles. There’s a separate set of articles about roles under the “Role:” pseudonamespace, but these mostly serve as disambiguation pages, directing readers to the relation type pages. We could set up more specific, per–relation type pages that have predictable titles and are linked to the data items. If so, then we wouldn’t necessarily need anything about documentation in the schema. Alternatively, we could add a property to the schema that indicates the QID of the data item about the role in the particular relation type. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. great question, I wasn't aware of these data items! It's a shame that we can't query the wikibase API by P21 permanent relation role ID What approach do you think is better? I can see downsides of both methods:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
openstreetmap/operations#903 would install an extension that would allow us to easily query for data items by the value of a statement. In theory, you can already do so using Sophox, but whatever process ingests new data items into Sophox hasn’t been working for a while: Sophox/sophox#31.
I was thinking of creating them as redirect pages for now, since there are already other pages that go into more detail, but in principle there could be full-fledged pages in the future.
Or maybe “Relation:multipolygon/outer”, assuming a relation type will never have a slash in it. Both this format and “Role:multipolygon/outer” carry the downside that, if the Translate extension is ever installed on the wiki (openstreetmap/operations#649), it’ll start using subpages for translations, with ISO language codes as subpage names. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. openstreetmap/operations#903 seems like the simplest solution to me, since it doesn't involve mass-creating wiki pages, nor inventing a new syntax for these pages' names. The only thing we would need to store in this repository is the P41 for each relation. Then we can lookup the documentation for each role using the same approach as presets & fields. I'm not very familiar with mediawiki, but we're running v1.39, so there's no major update required to install this extension? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There aren’t any technical blockers as far as I know. But that request has been languishing for a while, so it might be quicker to just create the redirects on the wiki as a stopgap. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For what it's worth, following a request on Talk:Wiki that cited this discussion, I added data item Descriptions for two dozen most common relation roles. Only a few are linked to Wiki articles proper (mostly unusable), such as Q22741 and a few I added are linked to redirects (such as Q22737 ). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've added a property called
It sounds like creating redirect or stub pages for each role isn't a popular idea.... Which means there's no way for iD to query this data without the WikibaseCirrusSearch extension. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Using the new relation member roles (P54) property, the existing Alternatively, if we’re comfortable with relying on the apparent English label naming convention for these role items, we can issue a single There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also just noticed that a bunch of the role items already have their sitelinks set to nonexistent pages like “Relation:boundary=admin centre”, as documented. This makes it possible to access these items directly using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. in that case, I believe that https://github.com/ideditor/schema-builder/compare/5157ab..31f9af means that the schema now has all the information required to construct an API query for the documentation (?) |
||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"additionalProperties": { | ||
"type": "string" | ||
} | ||
}, | ||
"examples": [ | ||
[{}], | ||
[{ "a": 1, "b": 2 }], | ||
[{ "a": 1 }, { "b": 2 }] | ||
], | ||
"description": "`*` can be used as a tag value. If multiple array items are specified, only 1 needs to match." | ||
}, | ||
"min": { | ||
"type": "integer", | ||
"description": "If unspecified, there is no minimum" | ||
}, | ||
"max": { | ||
"type": "integer", | ||
"description": "If unspecified, there is no maximum" | ||
} | ||
}, | ||
"required": ["matchTags"], | ||
"additionalProperties": false | ||
} | ||
} | ||
}, | ||
"required": ["id", "allowDuplicateMembers", "members"], | ||
"additionalProperties": false | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How useful is it to be able to combine multiple roles in the same role definition? Are there any relation types with lots of very similar roles that would have verbose definitions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PTv2's
stop(_on_demand)?(_exit_only|_entry_only)?
is probably the most verbose (likewise forplatform_*
). That would be 6 entries in a single JSON block.So, there would be 13+ translatable strings for the PTv2 schema. I'm not sure how we could optimise this further
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah OK, that’s what I was missing – a case where a relation type has lots of very similar roles.