-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgeography.py
382 lines (303 loc) · 23.6 KB
/
geography.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
from __future__ import annotations
from datetime import (
datetime,
date
)
from decimal import Decimal
from enum import Enum
import re
import sys
from typing import (
Any,
List,
Literal,
Dict,
Optional,
Union
)
from pydantic.version import VERSION as PYDANTIC_VERSION
if int(PYDANTIC_VERSION[0])>=2:
from pydantic import (
BaseModel,
ConfigDict,
Field,
field_validator
)
else:
from pydantic import (
BaseModel,
Field,
validator
)
metamodel_version = "None"
version = "None"
class WeakRefShimBaseModel(BaseModel):
__slots__ = '__weakref__'
class ConfiguredBaseModel(WeakRefShimBaseModel,
validate_assignment = True,
validate_all = True,
underscore_attrs_are_private = True,
extra = "forbid",
arbitrary_types_allowed = True,
use_enum_values = True):
pass
class RelativeTimeEnum(str, Enum):
BEFORE = "BEFORE"
AFTER = "AFTER"
AT_SAME_TIME_AS = "AT_SAME_TIME_AS"
class LandformEnum(str):
pass
class Identified(ConfiguredBaseModel):
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
class Typed(ConfiguredBaseModel):
type: Literal["Typed"] = Field("Typed", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Entity(Typed):
"""
A physical, digital, conceptual, or other kind of thing with some common characteristics
"""
type: Literal["Entity"] = Field("Entity", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Intangible(Entity):
"""
An entity that is not a physical object, process, or information
"""
type: Literal["Intangible"] = Field("Intangible", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class PhysicalEntity(Entity, Identified):
classification: Optional[str] = Field(None, description="""A precise classification of the thing, using a concept from an ontology, controlled vocabulary, thesaurus, or taxonomy. Some schema classes may choose to restrict the range of values which this slot can take, using `values_from`, or bindings.""")
ontology_types: Optional[List[str]] = Field(default_factory=list, description="""A collection of concepts that help to classify the thing, using concepts from an ontolology, thesaurus, or taxonomy.""")
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["PhysicalEntity"] = Field("PhysicalEntity", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Concept(Intangible, Identified):
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Concept"] = Field("Concept", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class InformationEntity(Intangible, Identified):
"""
An entity that describes some information
"""
describes: Optional[Any] = Field(None, description="""The thing that is being described""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["InformationEntity"] = Field("InformationEntity", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class PhysicalDevice(PhysicalEntity):
classification: Optional[str] = Field(None, description="""A precise classification of the thing, using a concept from an ontology, controlled vocabulary, thesaurus, or taxonomy. Some schema classes may choose to restrict the range of values which this slot can take, using `values_from`, or bindings.""")
ontology_types: Optional[List[str]] = Field(default_factory=list, description="""A collection of concepts that help to classify the thing, using concepts from an ontolology, thesaurus, or taxonomy.""")
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["PhysicalDevice"] = Field("PhysicalDevice", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class StructuredValue(Intangible):
"""
A value that is a structured collection of other values
"""
type: Literal["StructuredValue"] = Field("StructuredValue", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Role(Intangible):
type: Literal["Role"] = Field("Role", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Relationship(Intangible):
type: Literal["Relationship"] = Field("Relationship", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Location(StructuredValue):
type: Literal["Location"] = Field("Location", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class PointLocation(Location):
type: Literal["PointLocation"] = Field("PointLocation", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Specification(InformationEntity):
"""
A specification of a thing
"""
describes: Optional[Any] = Field(None, description="""The thing that is being described""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Specification"] = Field("Specification", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Procedure(Specification):
"""
A canonical series of actions conducted in a certain order or manner
"""
describes: Optional[Any] = Field(None, description="""The thing that is being described""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Procedure"] = Field("Procedure", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class EntitySet(Intangible):
"""
A group of things. The collection may be heterogeneous or homogeneous.
"""
members: Optional[List[Union[Entity,Intangible,PhysicalEntity,Event,PhysicalDevice,Place,Landform,AstronomicalBody,Concept,InformationEntity,StructuredValue,Role,Relationship,EntitySet,Quantity,QuantityRange,TimePointOrTemporalInterval,TemporalInterval,TimePoint,SimpleQuantity,Ratio,Duration,TemporalRelationship,Location,PostalAddress,PointLocation,GeoBoxLocation,GeoPointLocation,Specification,Procedure,QuantityKind,UnitConcept]]] = Field(default_factory=list, description="""The members of the collection""")
type: Literal["EntitySet"] = Field("EntitySet", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class QuantityKind(Concept):
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["QuantityKind"] = Field("QuantityKind", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Quantity(Intangible):
has_quantity_kind: Optional[str] = Field(None, description="""The kind of quantity""")
type: Literal["Quantity"] = Field("Quantity", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class SimpleQuantity(Quantity):
"""
A quantity is a property that can be measured or counted
"""
value: Optional[float] = Field(None, description="""The value of the quantity""")
unit: Optional[str] = Field(None)
has_quantity_kind: Optional[str] = Field(None, description="""The kind of quantity""")
type: Literal["SimpleQuantity"] = Field("SimpleQuantity", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Ratio(Quantity):
"""
A tuple of two quantities
"""
numerator: Optional[Union[Quantity,SimpleQuantity,Ratio,Duration]] = Field(None, description="""The numerator of the ratio""")
denominator: Optional[Union[Quantity,SimpleQuantity,Ratio,Duration]] = Field(None, description="""The denominator of the ratio""")
has_quantity_kind: Optional[str] = Field(None, description="""The kind of quantity""")
type: Literal["Ratio"] = Field("Ratio", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class QuantityRange(Intangible):
"""
A quantity range is a property that can be measured or counted
"""
lower_bound: Optional[Union[Quantity,SimpleQuantity,Ratio,Duration]] = Field(None, description="""The lower bound of the range""")
upper_bound: Optional[Union[Quantity,SimpleQuantity,Ratio,Duration]] = Field(None, description="""The upper bound of the range""")
type: Literal["QuantityRange"] = Field("QuantityRange", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class UnitConcept(Concept):
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["UnitConcept"] = Field("UnitConcept", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Event(Entity, Identified):
"""
A thing that happens
"""
starts_at: Optional[TimePoint] = Field(None)
ends_at: Optional[TimePoint] = Field(None)
happens_at: Optional[TimePoint] = Field(None)
has_interval: Optional[TemporalInterval] = Field(None)
has_duration: Optional[Duration] = Field(None)
is_ongoing_as_of: Optional[TimePoint] = Field(None)
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Event"] = Field("Event", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class TimePointOrTemporalInterval(Intangible):
starts_at: Optional[TimePoint] = Field(None)
ends_at: Optional[TimePoint] = Field(None)
type: Literal["TimePointOrTemporalInterval"] = Field("TimePointOrTemporalInterval", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class TemporalInterval(TimePointOrTemporalInterval):
"""
A period of time
"""
starts_at: Optional[TimePoint] = Field(None)
ends_at: Optional[TimePoint] = Field(None)
type: Literal["TemporalInterval"] = Field("TemporalInterval", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class TimePoint(TimePointOrTemporalInterval):
"""
A point in time. Can be fully specified, or specified in relative terms.
"""
year_value: Optional[int] = Field(None)
date_value: Optional[date] = Field(None)
time_value: Optional[str] = Field(None)
datetime_value: Optional[datetime ] = Field(None)
marker_event: Optional[str] = Field(None)
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
starts_at: Optional[TimePoint] = Field(None)
ends_at: Optional[TimePoint] = Field(None)
type: Literal["TimePoint"] = Field("TimePoint", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Duration(Quantity):
"""
A length of time
"""
has_quantity_kind: Optional[str] = Field(None, description="""The kind of quantity""")
type: Literal["Duration"] = Field("Duration", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class TemporalRelationship(Relationship):
"""
A relationship to another time point
"""
predicate: Optional[RelativeTimeEnum] = Field(None, description="""The relationship between the two time points""")
relative_to: Optional[Union[TemporalInterval, TimePoint, str]] = Field(None)
type: Literal["TemporalRelationship"] = Field("TemporalRelationship", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Place(PhysicalEntity):
"""
Entities that have a somewhat fixed, physical extension.
"""
address: Optional[PostalAddress] = Field(None)
geolocation: Optional[GeoPointLocation] = Field(None, description="""The geolocation of the place""")
bounding_coordinates: Optional[GeoBoxLocation] = Field(None, description="""The bounding coordinates of the place""")
classification: Optional[str] = Field(None, description="""A precise classification of the thing, using a concept from an ontology, controlled vocabulary, thesaurus, or taxonomy. Some schema classes may choose to restrict the range of values which this slot can take, using `values_from`, or bindings.""")
ontology_types: Optional[List[str]] = Field(default_factory=list, description="""A collection of concepts that help to classify the thing, using concepts from an ontolology, thesaurus, or taxonomy.""")
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Place"] = Field("Place", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class Landform(Place):
"""
A natural feature of the solid surface of the Earth or other planetary body
"""
address: Optional[PostalAddress] = Field(None)
geolocation: Optional[GeoPointLocation] = Field(None, description="""The geolocation of the place""")
bounding_coordinates: Optional[GeoBoxLocation] = Field(None, description="""The bounding coordinates of the place""")
classification: Optional[str] = Field(None, description="""A precise classification of the thing, using a concept from an ontology, controlled vocabulary, thesaurus, or taxonomy. Some schema classes may choose to restrict the range of values which this slot can take, using `values_from`, or bindings.""")
ontology_types: Optional[List[str]] = Field(default_factory=list, description="""A collection of concepts that help to classify the thing, using concepts from an ontolology, thesaurus, or taxonomy.""")
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["Landform"] = Field("Landform", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class AstronomicalBody(Place):
address: Optional[PostalAddress] = Field(None)
geolocation: Optional[GeoPointLocation] = Field(None, description="""The geolocation of the place""")
bounding_coordinates: Optional[GeoBoxLocation] = Field(None, description="""The bounding coordinates of the place""")
classification: Optional[str] = Field(None, description="""A precise classification of the thing, using a concept from an ontology, controlled vocabulary, thesaurus, or taxonomy. Some schema classes may choose to restrict the range of values which this slot can take, using `values_from`, or bindings.""")
ontology_types: Optional[List[str]] = Field(default_factory=list, description="""A collection of concepts that help to classify the thing, using concepts from an ontolology, thesaurus, or taxonomy.""")
description: Optional[str] = Field(None, description="""A human-readable description for a thing""")
id: str = Field(..., description="""A unique identifier for a thing""")
name: Optional[str] = Field(None, description="""A human-readable name for a thing""")
type: Literal["AstronomicalBody"] = Field("AstronomicalBody", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class PostalAddress(StructuredValue):
"""
Represents an Address
"""
street_address: Optional[str] = Field(None, description="""The street address""")
street_address_additional: Optional[str] = Field(None)
city: Optional[str] = Field(None, description="""The city""")
state: Optional[str] = Field(None, description="""The state""")
postal_code: Optional[str] = Field(None, description="""The postal code or zip code""")
country: Optional[str] = Field(None, description="""The country""")
type: Literal["PostalAddress"] = Field("PostalAddress", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class GeoPointLocation(PointLocation):
latitude: Optional[Decimal] = Field(None, description="""The latitude of the location""")
longitude: Optional[Decimal] = Field(None, description="""The longitude of the location""")
altitude: Optional[Decimal] = Field(None, description="""The altitude of the location""")
type: Literal["GeoPointLocation"] = Field("GeoPointLocation", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
class GeoBoxLocation(Location):
west_bounding_coordinate: Optional[Decimal] = Field(None, description="""The westernmost coordinate of the location""")
east_bounding_coordinate: Optional[Decimal] = Field(None, description="""The easternmost coordinate of the location""")
north_bounding_coordinate: Optional[Decimal] = Field(None, description="""The northernmost coordinate of the location""")
south_bounding_coordinate: Optional[Decimal] = Field(None, description="""The southernmost coordinate of the location""")
type: Literal["GeoBoxLocation"] = Field("GeoBoxLocation", description="""A type for a thing. The range of this should be a class within the schema. It is intended for schema-based classification. Anything beneath the shoreline of the schema should use `classification`.""")
# Update forward refs
# see https://pydantic-docs.helpmanual.io/usage/postponed_annotations/
Identified.update_forward_refs()
Typed.update_forward_refs()
Entity.update_forward_refs()
Intangible.update_forward_refs()
PhysicalEntity.update_forward_refs()
Concept.update_forward_refs()
InformationEntity.update_forward_refs()
PhysicalDevice.update_forward_refs()
StructuredValue.update_forward_refs()
Role.update_forward_refs()
Relationship.update_forward_refs()
Location.update_forward_refs()
PointLocation.update_forward_refs()
Specification.update_forward_refs()
Procedure.update_forward_refs()
EntitySet.update_forward_refs()
QuantityKind.update_forward_refs()
Quantity.update_forward_refs()
SimpleQuantity.update_forward_refs()
Ratio.update_forward_refs()
QuantityRange.update_forward_refs()
UnitConcept.update_forward_refs()
Event.update_forward_refs()
TimePointOrTemporalInterval.update_forward_refs()
TemporalInterval.update_forward_refs()
TimePoint.update_forward_refs()
Duration.update_forward_refs()
TemporalRelationship.update_forward_refs()
Place.update_forward_refs()
Landform.update_forward_refs()
AstronomicalBody.update_forward_refs()
PostalAddress.update_forward_refs()
GeoPointLocation.update_forward_refs()
GeoBoxLocation.update_forward_refs()