wiki/assets/opensearch/geo.xsd

201 lines
12 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
OpenSearch Geo Extension 1.0 Draft 2 XML Schema
Copyright (c) 2021 ~lucidiot
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, version 3.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
This file was derived from the OpenSearch Geo Extension 1.0 Draft 2 at
<https://github.com/dewitt/opensearch/blob/8446769af24e313f308beeb590173c1aca57de9f/mediawiki/Specifications/OpenSearch/Extensions/Geo/1.0/Draft%202.wiki>
-->
<xs:schema
targetNamespace="http://a9.com/-/opensearch/extensions/geo/1.0/"
elementFormDefault="qualified"
xmlns="http://a9.com/-/opensearch/extensions/geo/1.0/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
>
<xs:simpleType name="Latitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-90" />
<xs:maxInclusive value="90" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Longitude">
<xs:restriction base="xs:decimal">
<xs:minInclusive value="-180" />
<xs:maxInclusive value="180" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Box">
<xs:restriction base="xs:string">
<xs:pattern value="[+-]?(?:1(?:[0-7]\d|80)|0?\d{2})(?:.\d+)?,\s*[+-]?(?:[0-8][0-9]|90)(?:.\d+)?,\s*[+-]?(?:1(?:[0-7]\d|80)|0?\d{2})(?:.\d+)?,\s*[+-]?(?:[0-8][0-9]|90)(?:.\d+)?" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Polygon">
<xs:restriction base="xs:string">
<xs:pattern value="(?:[+-]?(?:[0-8][0-9]|90)(?:.\d+)?,[+-]?(?:1(?:[0-7]\d|80)|0?\d{2})(?:.\d+)?,)*[+-]?(?:[0-8][0-9]|90)(?:.\d+)?,[+-]?(?:1(?:[0-7]\d|80)|0?\d{2})(?:.\d+)?" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Geometry">
<xs:restriction base="xs:string">
<!--
XSD does not support defining reusable groups in regexes, so this uses some "manual variable expansion":
number: [+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)
non_empty_point: \(\s*number\s+number\s*\)
point: [Pp][Oo][Ii][Nn][Tt]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|non_empty_point)
point_text: (?:[Ee][Mm][Pp][Tt][Yy]|non_empty_point)
linestring: [Ll][Ii][Nn][Ee][Ss][Tt][Rr][Ii][Nn][Gg]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:non_empty_point\s*,\s*)*non_empty_point\s*\))
linestring_text: (?:[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:non_empty_point\s*,\s*)*non_empty_point\s*\))
polygon: [Pp][Oo][Ll][Yy][Gg][Oo][Nn]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:linestring_text\s*,\s*)*linestring_text\s*\))
polygon_text: (?:[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:linestring_text\s*,\s*)*linestring_text\s*\))
multipoint: [Mm][Uu][Ll][Tt][Ii][Pp][Oo][Ii][Nn][Tt]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:point_text\s*,\s*)*point_text\s*\))
multilinestring: [Mm][Uu][Ll][Tt][Ii][Ll][Ii][Nn][Ee][Ss][Tt][Rr][Ii][Nn][Gg]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:linestring_text\s*,\s*)*linestring_text\s*\))
multipolygon: [Mm][Uu][Ll][Tt][Ii][Pp][Oo][Ll][Yy][Gg][Oo][Nn]\s*(?:\s+[Ee][Mm][Pp][Tt][Yy]|\(\s*(?:polygon_text\s*,\s*)*polygon_text\s*\))
-->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\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)\s*\)\s*,\s*)*\(\s*[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)\s+[+-]?(?:\d+(?:\.\d*)?|\.\d+)(?:[Ee][+-]?\d+)\s*\)\s*\))\s*\))\s*\))" />
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="Relation">
<xs:restriction base="xs:string">
<xs:enumeration value="intersects">
<xs:annotation>
<xs:documentation>
Return records that intersect with the query.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="contains">
<xs:annotation>
<xs:documentation>
Return records that contain the query entirely.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
<xs:enumeration value="disjoint">
<xs:annotation>
<xs:documentation>
Return records that do not intersect with the query.
</xs:documentation>
</xs:annotation>
</xs:enumeration>
</xs:restriction>
</xs:simpleType>
<xs:attributeGroup name="QueryAttributes">
<xs:annotation>
<xs:documentation>
Additional attributes defined by the OpenSearch Geo extension for the Query element.
</xs:documentation>
</xs:annotation>
<xs:attribute name="name" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
Replaced with a string describing the location (place name) to perform the search.
This location string will be parsed and geocoded by the search service.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="locationString" type="xs:string" use="prohibited">
<xs:annotation>
<xs:documentation>
Deprecated. Use the "name" parameter instead.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lat" type="Latitude" use="optional">
<xs:annotation>
<xs:documentation>
Latitude in decimal degrees in EPSG:4326 (typical WGS84 coordinates as returned by a GPS receiver).
This parameter should also include a "radius" parameter that specifies the search radius, in meters.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="lon" type="Longitude" use="optional">
<xs:annotation>
<xs:documentation>
Longitude in decimal degrees in EPSG:4326 (typical WGS84 coordinates as returned by a GPS receiver).
This parameter should also include a "radius" parameter that specifies the search radius, in meters.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="radius" type="xs:integer" use="optional">
<xs:annotation>
<xs:documentation>
Search distance from the point defined by `lat` and `lon`.
The distance is in meters along the Earth's surface.
If no radius is supplied, then the search service is free to use a default radius
but should specify this radius in the returned result.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="box" type="Box" use="optional">
<xs:annotation>
<xs:documentation>
Replaced with the bounding box to search for geospatial results within.
The box is defined by "west, south, east, north" coordinates of longitude, latitude, in EPSG 4236 decimal degrees.
This is also commonly referred to by minX, minY, maxX, maxY (where longitude is the X-axis, and latitude is the Y-axis),
or also SouthWest corner and NorthEast corner.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="geometry" type="Geometry" use="optional">
<xs:annotation>
<xs:documentation>
Replaced with a geometry defined using the Well Known Text (WKT) standard.
The following 2D geometric objects can be described:
POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON.
Note that the WKT coordinate pairs are in lon, lat order; opposite to GeoRSS.
Polygons are a collection of linear rings. The outer ring is expressed in counter-clockwise order.
Internal rings have the opposite orientation, appearing as clockwise
(see 6.1.11.1 in OGC Simple Features Specification v. 1.2.0).
Spaces must be URL encoded ('%20' or '+') in the request.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="polygon" type="Polygon" use="prohibited">
<xs:annotation>
<xs:documentation>
Deprecated. Use the geometry parameter instead.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="relation" type="Relation" default="intersects">
<xs:annotation>
<xs:documentation>
The spatial relation of the search. By default the geo searches return the records that intersect the query.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="uid" type="xs:string" use="optional">
<xs:annotation>
<xs:documentation>
The identifier of the resource within the search engine context (local reference).
This parameter is used to query resources by their fragment identifier, unique within the search scope only.
It can be used to query local identifiers that are not URIs, including the support of GML identifiers.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:attributeGroup>
</xs:schema>