Package gavo :: Package registry :: Module model
[frames] | no frames]

Source Code for Module gavo.registry.model

  1  """ 
  2  The schema and XML namespaces for OAI/VOR documents. 
  3  """ 
  4   
  5  #c Copyright 2008-2019, the GAVO project 
  6  #c 
  7  #c This program is free software, covered by the GNU GPL.  See the 
  8  #c COPYING file in the source distribution. 
  9   
 10   
 11  from gavo import base 
 12  from gavo.utils.stanxml import Element, schemaURL, registerPrefix, xsiPrefix 
 13   
 14   
15 -class Error(base.Error):
16 pass
17 18 19 # See stanxml for the root of all the following evil. 20 # If you change schemaURL here, you will quite certainly have 21 # to fix testtricks.VO_SCHEMATA as well. 22 registerPrefix("oai", "http://www.openarchives.org/OAI/2.0/", 23 schemaURL("OAI-PMH.xsd")) 24 registerPrefix("oai_dc", "http://www.openarchives.org/OAI/2.0/oai_dc/", 25 schemaURL("oai_dc.xsd")) 26 registerPrefix("ri", 27 "http://www.ivoa.net/xml/RegistryInterface/v1.0", 28 schemaURL("RegistryInterface-v1.0.xsd")) 29 registerPrefix("vg", "http://www.ivoa.net/xml/VORegistry/v1.0", 30 schemaURL("VORegistry-v1.0.xsd")) 31 registerPrefix("vr", "http://www.ivoa.net/xml/VOResource/v1.0", 32 schemaURL("VOResource-v1.1.xsd")) 33 registerPrefix("dc", "http://purl.org/dc/elements/1.1/", 34 schemaURL("simpledc20021212.xsd")) 35 registerPrefix("vs", "http://www.ivoa.net/xml/VODataService/v1.1", 36 schemaURL("VODataService-v1.1.xsd")) 37 registerPrefix("cs", "http://www.ivoa.net/xml/ConeSearch/v1.0", 38 schemaURL("ConeSearch-v1.1.xsd")) 39 registerPrefix("sia", "http://www.ivoa.net/xml/SIA/v1.1", 40 schemaURL("SIA-v1.2.xsd")) 41 registerPrefix("slap", "http://www.ivoa.net/xml/SLAP/v1.0", 42 schemaURL("SLAP-v1.1.xsd")) 43 registerPrefix("ssap", "http://www.ivoa.net/xml/SSA/v1.1", 44 schemaURL("SSA-v1.2.xsd")) 45 registerPrefix("tr", "http://www.ivoa.net/xml/TAPRegExt/v1.0", 46 schemaURL("TAPRegExt-v1.0.xsd")) 47 registerPrefix("vstd", "http://www.ivoa.net/xml/StandardsRegExt/v1.0", 48 schemaURL("StandardsRegExt-1.0.xsd")) 49 registerPrefix("doc", "http://www.ivoa.net/xml/DocRegExt/v1", 50 schemaURL("DocRegExt-v1.0.xsd")) 51 52
53 -class _ResourceNameMixin(object):
54 _a_ivoId = None 55 _name_a_ivoId = "ivo-id"
56 57
58 -class OAI(object):
59 """is a container for classes modelling OAI elements. 60 """
61 - class OAIElement(Element):
62 _prefix = "oai"
63
64 - class PMH(OAIElement):
65 name_ = "OAI-PMH"
66
67 - class responseDate(OAIElement): pass
68
69 - class request(OAIElement):
70 _mayBeEmpty = True 71 _a_verb = None 72 _a_metadataPrefix = None
73
74 - class metadata(OAIElement): pass
75
76 - class Identify(OAIElement): pass
77
78 - class ListIdentifiers(OAIElement): pass
79
80 - class ListRecords(OAIElement): pass
81
82 - class GetRecord(OAIElement): pass
83
84 - class ListMetadataFormats(OAIElement): pass
85
86 - class ListSets(OAIElement):
87 _mayBeEmpty = True
88
89 - class header(OAIElement):
90 _a_status = None
91
92 - class error(OAIElement):
93 _mayBeEmpty = True 94 _a_code = None
95
96 - class record(OAIElement): pass
97
98 - class identifier(OAIElement): pass
99
100 - class datestamp(OAIElement): pass
101
102 - class setSpec(OAIElement): pass
103
104 - class repositoryName(OAIElement): pass
105
106 - class baseURL(OAIElement): pass
107
108 - class adminEmail(OAIElement): pass
109
110 - class earliestDatestamp(OAIElement): pass
111
112 - class deletedRecord(OAIElement): pass
113
114 - class granularity(OAIElement): pass
115
116 - class description(OAIElement): pass
117
118 - class protocolVersion(OAIElement): pass
119
120 - class metadataFormat(OAIElement): pass
121
122 - class metadataPrefix(OAIElement): pass
123
124 - class schema(OAIElement): pass
125
126 - class metadataNamespace(OAIElement): pass
127
128 - class set(OAIElement): pass
129
130 - class setName(OAIElement): pass
131
132 - class setDescription(OAIElement): pass
133
134 - class resumptionToken(OAIElement): pass
135 # optional attributes not supported here 136 # The string value in here has a structure; see oaiinter. 137 138
139 -class OAIDC:
140 """is a container for OAI's Dublin Core metadata model. 141 """
142 - class OAIDCElement(Element):
143 _prefix = "oai_dc"
144
145 - class dc(OAIDCElement):
146 pass
147 148
149 -class VOR:
150 """is a container for classes modelling elements from VO Resource. 151 """
152 - class VORElement(Element):
153 _prefix = "vr" 154 _local = True
155
156 - class Resource(VORElement):
157 # This is "abstract" in that only derived elements may be present 158 # in an instance document (since VOR doesn't define any global elements). 159 # Typically, this will be vr:Resource elements with some funky xsi:type 160 _a_created = None 161 _a_updated = None 162 _a_status = None 163 name_ = "Resource" 164 _local = False 165 _additionalPrefixes = frozenset(["vr", "ri", "xsi"])
166
167 - class Organisation(Resource):
168 _a_xsi_type = "vr:Organisation"
169
170 - class Service(Resource):
171 _a_xsi_type = "vr:Service"
172
173 - class validationLevel(VORElement):
174 _a_validatedBy = None
175
176 - class title(VORElement): pass
177
178 - class shortName(VORElement): pass
179
180 - class ResourceName(VORElement):
181 _a_ivoId = None 182 _name_a_ivoId = "ivo-id"
183
184 - class identifier(VORElement): pass
185
186 - class altIdentifier(VORElement): pass
187
188 - class curation(VORElement): pass
189
190 - class content(VORElement): pass
191
192 - class creator(VORElement): pass
193
194 - class contributor(ResourceName): pass
195
196 - class date(VORElement):
197 _a_role = None
198
199 - class version(VORElement): pass
200
201 - class contact(VORElement): pass
202
203 - class publisher(ResourceName): pass
204
205 - class facility(VORElement): pass
206
207 - class instrument(VORElement): pass
208
209 - class name(VORElement): pass
210
211 - class address(VORElement): pass
212
213 - class email(VORElement): pass
214
215 - class telephone(VORElement): pass
216
217 - class logo(VORElement): pass
218
219 - class subject(VORElement): pass
220
221 - class description(VORElement): pass
222
223 - class source(VORElement):
224 _a_format = None
225
226 - class referenceURL(VORElement): pass
227
228 - class type(VORElement): pass
229
230 - class contentLevel(VORElement): pass
231
232 - class relationship(VORElement):
233 - def _setupNode(self):
234 self.__isEmpty = None 235 self._setupNodeNext(VOR.relationship)
236
237 - def isEmpty(self):
238 # special rule: a relationship is empty if there's no relatedResource 239 # in them (this is a simplification of "don't count relationshipType 240 # since it's always non-empty"). 241 if self._isEmptyCache is None: 242 self._isEmptyCache = True 243 for c in self.iterChildrenOfType(VOR.relatedResource): 244 self._isEmptyCache = False 245 break 246 return self._isEmptyCache
247
248 - class relationshipType(VORElement): pass
249
250 - class relatedResource(VORElement):
251 _a_ivoId = None 252 _name_a_ivoId = "ivo-id"
253
254 - class rights(VORElement):
255 _a_rightsURI = None
256
257 - class capability(VORElement):
258 name_ = "capability" 259 _additionalPrefixes = xsiPrefix 260 _a_standardID = None
261
262 - class interface(VORElement):
263 name_ = "interface" 264 _additionalPrefixes = xsiPrefix 265 _a_version = None 266 _a_role = None 267 _a_qtype = None
268
269 - class WebBrowser(interface):
270 _a_xsi_type = "vr:WebBrowser"
271
272 - class WebService(interface):
273 _a_xsi_type = "vr:WebService"
274
275 - class wsdlURL(VORElement): pass
276
277 - class accessURL(VORElement):
278 _a_use = None
279
280 - class mirrorURL(VORElement): pass
281
282 - class securityMethod(VORElement):
283 - def isEmpty(self):
284 return self.standardId is None
285 _a_standardId = None
286 287
288 -class RI:
289 """is a container for classes modelling elements from IVOA Registry Interface. 290 """
291 - class RIElement(Element):
292 _prefix = "ri"
293
294 - class VOResources(RIElement): pass
295
296 - class Resource(VOR.Resource):
297 _prefix = "ri"
298 299
300 -class VOG:
301 """is a container for classes modelling elements from VO Registry. 302 """
303 - class VOGElement(Element):
304 _prefix = "vg" 305 _local = True
306
307 - class Resource(RI.Resource):
308 _a_xsi_type = "vg:Registry" 309 _additionalPrefixes = frozenset(["vg", "xsi"])
310
311 - class Authority(RI.Resource):
312 _a_xsi_type = "vg:Authority" 313 _additionalPrefixes = frozenset(["vg", "xsi"])
314
315 - class capability(VOR.capability):
316 _a_standardID = "ivo://ivoa.net/std/Registry"
317
318 - class Harvest(capability):
319 _a_xsi_type = "vg:Harvest" 320 _additionalPrefixes = frozenset(["vg", "xsi", "vs"])
321
322 - class Search(VOGElement):
323 _a_xsi_type = "vg:Search" 324 _additionalPrefixes = frozenset(["vg", "xsi", "vs"])
325
326 - class OAIHTTP(VOR.interface):
327 _a_xsi_type = "vg:OAIHTTP"
328 # namespace declaration has happened in enclosing element 329
330 - class OAISOAP(VOR.interface):
331 _a_xsi_type = "vg:OAISOAP"
332 # namespace declaration has happened in enclosing element 333
334 - class full(VOGElement): pass
335
336 - class managedAuthority(VOGElement): pass
337
338 - class validationLevel(VOGElement): pass
339
340 - class description(VOGElement): pass
341
342 - class interface(VOGElement): pass
343
344 - class maxRecords(VOGElement): pass
345
346 - class extensionSearchSupport(VOGElement): pass
347
348 - class optionalProtocol(VOGElement): pass
349
350 - class managingOrg(VOGElement, _ResourceNameMixin): pass
351 352
353 -class DC:
354 """is a container for classes modelling elements from Dublin Core. 355 """
356 - class DCElement(Element):
357 _prefix = "dc"
358
359 - class contributor(DCElement): pass
360
361 - class coverage(DCElement): pass
362
363 - class creator(DCElement): pass
364
365 - class date(DCElement): pass
366
367 - class description(DCElement): pass
368
369 - class format(DCElement): pass
370
371 - class identifier(DCElement): pass
372
373 - class language(DCElement): pass
374
375 - class publisher(DCElement): pass
376
377 - class relation(DCElement): pass
378
379 - class rights(DCElement): pass
380
381 - class source(DCElement): pass
382
383 - class subject(DCElement): pass
384
385 - class title(DCElement): pass
386
387 - class type(DCElement): pass
388 389
390 -class VS:
391 """A container for classes modelling elements from VODataService 1.1. 392 """
393 - class VSElement(Element):
394 _prefix = "vs" 395 _local = True
396
397 - class DataCollection(RI.Resource):
398 _a_xsi_type = "vs:DataCollection" 399 _additionalPrefixes = frozenset(["vs", "xsi"])
400
401 - class tableset(VSElement):
402 _additionalPrefixes = xsiPrefix 403 _mayBeEmpty = True 404 _childSequence = ["schema"]
405
406 - class schema(VSElement):
407 _childSequence = ["name", "title", "description", "utype", 408 "table"]
409
410 - class title(VSElement): pass
411 - class utype(VSElement): pass
412
413 - class table(VSElement):
414 _a_type = None 415 _childSequence = ["name", "title", "description", "utype", 416 "column", "foreignKey"]
417
418 - class foreignKey(VSElement):
419 _childSequence = ["targetTable", "fkColumn", "description", "utype"]
420
421 - class targetTable(VSElement): pass
422
423 - class fkColumn(VSElement):
424 _childSequence = ["fromColumn", "targetColumn"]
425
426 - class fromColumn(VSElement): pass
427 - class targetColumn(VSElement): pass
428 - class flag(VSElement): pass
429 - class regionOfRegard(VSElement): pass
430
431 - class facility(VSElement): pass
432
433 - class instrument(VSElement): pass
434
435 - class coverage(VSElement): pass
436
437 - class footprint(VSElement):
438 _a_ivoId = None 439 _name_a_ivoId = "ivo-id"
440
441 - class waveband(VSElement): pass
442
443 - class spectral(VSElement): pass
444
445 - class spatial(VSElement): pass
446
447 - class temporal(VSElement): pass
448
449 - class format(VSElement):
450 _a_isMIMEType = None
451
452 - class accessURL(VSElement): pass
453
454 - class ParamHTTP(VOR.interface):
455 _a_xsi_type = "vs:ParamHTTP" 456 _additionalPrefixes = frozenset(["vg", "xsi"])
457
458 - class resultType(VSElement): pass
459
460 - class queryType(VSElement): pass
461
462 - class param(VSElement):
463 _a_std = "false"
464
465 - class name(VSElement): pass
466
467 - class description(VSElement): pass
468
469 - class unit(VSElement): pass
470
471 - class ucd(VSElement): pass
472
473 - class Service(VOR.Resource): pass
474
475 - class DataResource(Service):
476 _a_xsi_type = "vs:DataResource" 477 _additionalPrefixes = frozenset(["vs", "xsi"])
478
479 - class DataService(DataResource):
480 _a_xsi_type = "vs:DataService"
481
482 - class CatalogResource(DataResource):
483 _a_xsi_type = "vs:CatalogResource"
484
485 - class CatalogService(CatalogResource):
486 _a_xsi_type = "vs:CatalogService" 487 _additionalPrefixes = frozenset(["vs", "xsi"])
488
489 - class ServiceReference(VSElement):
490 _a_ivoId = None 491 _name_a_ivoId = "ivo-id"
492
493 - class column(VSElement): pass
494
495 - class dataType(VSElement):
496 name_ = "dataType" 497 _additionalPrefixes = xsiPrefix 498 _a_arraysize = None 499 _a_delim = None 500 _a_extendedSchema = None 501 _a_extendedType = None
502
503 - class dataType(dataType):
504 name_ = "dataType"
505
506 - class voTableDataType(dataType):
507 name_ = "dataType" 508 _a_xsi_type = "vs:VOTableType"
509
510 - class tapType(dataType):
511 name_ = "dataType" 512 _a_size = None 513 _a_xsi_type = "vs:TAPType"
514 515
516 -class SIA(object):
517 """A container for classes modelling elements for describing simple 518 image access services. 519 """
520 - class SIAElement(Element):
521 _prefix = "sia" 522 _local = True
523
524 - class interface(VOR.interface):
525 _prefix = "sia" 526 _a_role = "std" 527 _additionalPrefixes = frozenset(["vs", "xsi"]) 528 _a_xsi_type = "vs:ParamHTTP"
529
530 - class capability(VOR.capability):
531 _a_standardID = "ivo://ivoa.net/std/SIA" 532 _a_xsi_type = "sia:SimpleImageAccess" 533 _additionalPrefixes = frozenset(["sia", "xsi"])
534
535 - class capability2(capability):
536 # an artificial class to let me fix the standard id for SIAPv2 537 _a_standardID = "ivo://ivoa.net/std/SIA#query-2.0"
538
539 - class imageServiceType(SIAElement): pass
540
541 - class maxQueryRegionSize(SIAElement): pass
542
543 - class maxImageExtent(SIAElement): pass
544
545 - class maxImageSize(SIAElement): pass
546
547 - class maxFileSize(SIAElement): pass
548
549 - class maxRecords(SIAElement): pass
550
551 - class long(SIAElement): pass
552
553 - class lat(SIAElement): pass
554
555 - class testQuery(SIAElement): pass
556
557 - class pos(SIAElement): pass
558
559 - class size(SIAElement): pass
560 561
562 -class SCS(object):
563 """A container for elements describing Simple Cone Search services. 564 """
565 - class SCSElement(Element):
566 _prefix = "cs" 567 _local = True
568
569 - class interface(VOR.interface):
570 _prefix = "cs" 571 _a_role = "std" 572 _a_xsi_type = "vs:ParamHTTP" 573 _additionalPrefixes = frozenset(["xsi", "vs"])
574
575 - class capability(VOR.capability):
576 _a_standardID = "ivo://ivoa.net/std/ConeSearch" 577 _a_xsi_type = "cs:ConeSearch" 578 _additionalPrefixes = frozenset(["xsi", "vs"])
579
580 - class maxSR(SCSElement): pass
581
582 - class maxRecords(SCSElement): pass
583
584 - class verbosity(SCSElement): pass
585
586 - class testQuery(SCSElement): pass
587 - class ra(SCSElement): pass
588 - class dec(SCSElement): pass
589 - class sr(SCSElement): pass
590 - class extras(SCSElement): pass
591 592
593 -class SSAP(object):
594 """A container for the elements of the SSA registry extension. 595 """
596 - class SSAElement(Element):
597 _prefix = "ssap" 598 _local = True
599
600 - class capability(VOR.capability):
601 _a_standardID = "ivo://ivoa.net/std/SSA" 602 _a_xsi_type = "ssap:SimpleSpectralAccess" 603 _additionalPrefixes = frozenset(["xsi", "vs"])
604
605 - class interface(VOR.interface):
606 _prefix = "ssap" 607 _a_role = "std" 608 _additionalPrefixes = frozenset(["vs", "xsi"]) 609 _a_xsi_type = "vs:ParamHTTP"
610
611 - class complianceLevel(SSAElement): pass
612 - class dataSource(SSAElement): pass
613 - class creationType(SSAElement): pass
614 - class maxSearchRadius(SSAElement): pass
615 - class maxRecords(SSAElement): pass
616 - class defaultMaxRecords(SSAElement): pass
617 - class maxAperture(SSAElement): pass
618 - class maxFileSize(SSAElement): pass
619 - class supportedFrame(SSAElement): pass
620 - class testQuery(SSAElement): pass
621 - class queryDataCmd(SSAElement): pass
622 623
624 -class SLAP(object):
625 """A container for the elements of the SSA registry extension. 626 """
627 - class SLAPElement(Element):
628 _prefix = "slap" 629 _local = True
630
631 - class capability(VOR.capability):
632 _a_standardID = "ivo://ivoa.net/std/SLAP" 633 _a_xsi_type = "slap:SimpleLineAccess" 634 _additionalPrefixes = frozenset(["xsi", "vs"])
635
636 - class interface(VOR.interface):
637 _a_role = "std" 638 _additionalPrefixes = frozenset(["vs", "xsi"]) 639 _a_xsi_type = "vs:ParamHTTP"
640
641 - class complianceLevel(SLAPElement): pass
642 - class dataSource(SLAPElement): pass
643 - class testQuery(SLAPElement): pass
644 - class queryDataCmd(SLAPElement): pass
645 646
647 -class TR(object):
648 """A container for elements describing TAP services. 649 """
650 - class TRElement(Element):
651 _prefix = "tr" 652 _local = True
653
654 - class interface(VOR.interface):
655 _a_role = "std" 656 _a_xsi_type = "vs:ParamHTTP" 657 _additionalPrefixes = frozenset(["xsi", "vs"])
658
659 - class capability(VOR.capability):
660 _a_standardID = "ivo://ivoa.net/std/TAP" 661 _a_xsi_type = "tr:TableAccess" 662 _additionalPrefixes = frozenset(["tr", "xsi"])
663
664 - class dataModel(TRElement):
665 _a_ivoId = None 666 _name_a_ivoId = "ivo-id"
667
668 - class label(TRElement):
669 pass
670
671 - class language(TRElement):
672 _a_LANG = None
673
674 - class outputFormat(TRElement):
675 _a_FORMAT = None 676 _a_mime = None 677 _a_ivoId = None 678 _name_a_ivoId = "ivo-id"
679
680 - class uploadMethod(TRElement):
681 _mayBeEmpty = True 682 _a_protocol = None 683 _a_ivoId = None 684 _name_a_ivoId = "ivo-id"
685
686 - class default(TRElement):
687 _a_unit = None
688
689 - class hard(TRElement):
690 _a_unit = None
691
692 - class version(TRElement):
693 _a_ivoId = None 694 _name_a_ivoId = "ivo-id"
695
696 - class languageFeatures(TRElement):
697 _a_type = None
698
699 - class alias(TRElement): pass
700 - class description(TRElement): pass
701 - class executionDuration(TRElement): pass
702 - class mime(TRElement): pass
703 - class name(TRElement): pass
704 - class parameter(TRElement): pass
705 - class protocol(TRElement): pass
706 - class retentionPeriod(TRElement): pass
707 - class outputLimit(TRElement): pass
708 - class form(TRElement): pass
709 - class uploadLimit(TRElement): pass
710 - class feature(TRElement): pass
711 712
713 -class VSTD(object):
714 """A container for elements from StandardsRegExt. 715 """
716 - class VSTDElement(Element):
717 _prefix = "vstd" 718 _local = True
719
720 - class endorsedVersion(VSTDElement):
721 _a_status = "n/a" 722 _a_use = "preferred"
723
724 - class Standard(RI.Resource):
725 _a_xsi_type = "vstd:Standard" 726 _additionalPrefixes = frozenset(["vstd", "xsi"])
727
728 - class deprecated(VSTDElement): pass
729 - class key(VSTDElement): pass
730 - class description(VSTDElement): pass
731 - class name(VSTDElement): pass
732 733
734 -class DOC(object):
735 """A container for elements from DocRegExt. 736 """
737 - class DOCElement(Element):
738 _prefix = "doc" 739 _local = True
740
741 - class Document(RI.Resource):
742 _a_xsi_type = "doc:Document" 743 _additionalPrefixes = frozenset(["doc", "xsi"])
744
745 - class capability(DOCElement):
746 _a_xsi_type = "doc:Edition" 747 _a_languageCode = None 748 _a_locTitle = None
749
750 - class languageCode(DOCElement): pass
751 - class locTitle(DOCElement): pass
752