source: TI05-delivery/ows_framework/trunk/ows_common/ows_common/iso19115_subset.py @ 2501

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_common/ows_common/iso19115_subset.py@2501
Revision 2501, 4.2 KB checked in by spascoe, 12 years ago (diff)

Many new ideas in this commit. It's still in a state of flux.
I'm exploring using decorators and class attributes with the prefix "_ows"
to declare properties that need to be in the OWS capabilities document.

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Classes modelling the OWS ISO19115 subset package v1.1.0.
7
8@author: Stephen Pascoe
9"""
10
11class LanguageString(str):
12    """
13    If you wish to attach a language identifier to a string use this
14    class.  Otherwise normal strings can be used in place of LanguageString.
15   
16    @ivar lang: language identifier
17    @type lang: str
18
19    """
20   
21    def __init__(self, value, lang=None):
22        super(LanguageString, self).__init__(value)
23        self.lang = lang
24
25class Code(str):
26    """
27    If you wish to attach a codeSpace to a Code element use this class,
28    otherwise it can be substituted with a string
29
30    @ivar code
31    @type code: str
32    @ivar codeSpace: URI qualifying self.code
33    @type codeSpace: None or char
34
35    """
36
37    def __init__(self, code, codeSpace=None):
38        super(Code, self).__init__(code)
39        self.codeSpace = codeSpace
40
41class Keywords(list):
42    """
43    If you wish to attach a type code to a keyword list use this class.
44    Otherwise any iterable can be used in place of Keywords.
45
46    @ivar type
47    @type type: Code
48
49    """
50    __slots__ = ['type']
51
52    def __init__(self, type=None):
53        self.type = type
54       
55class Xlink(object):
56    """
57    This class exposes all xlink:simpleLink attributes.
58
59    @ivar href: A URL
60    @type href: str
61    @ivar role
62    @type role: None or str
63    @ivar show
64    @type show: None or str
65    @ivar title
66    @type title: None or str
67    @ivar actuate
68    @type actuate: None or str
69    @ivar arcrole
70    @type arcrole: None or str
71
72    """
73    def __init__(self, href, role=None, show=None, title=None, actuate=None,
74                 arcrole=None):
75        self.href = href
76        self.role = role
77        self.show = show
78        self.title = title
79        self.actuate = actuate
80        self.arcrole = arcrole
81
82class OnlineResource(Xlink):
83    pass
84
85
86#ResponsibleParty, Address, Telephone, & Contact classes added by D.Lowe
87class ResponsibleParty(object):
88    """
89    @ivar individualName
90    @type individualName: None or str
91    @ivar positionName
92    @type positionName: None or str
93    @ivar role
94    @type role: None or Code
95    @ivar contactInfo
96    @type contactInfo: None or Contact
97    """
98    def __init__(self, individualName=None, positionName=None, role=None, contactInfo=None):
99        self.individualName=individualName
100        self.positionName=positionName
101        self.role=role   
102        self.contactInfo=contactInfo
103
104class Address(object):
105    """
106    @ivar deliveryPoints
107    @type deliveryPoints: iterable of str objects
108    @ivar city
109    @type city: None or str
110    @ivar administrativeArea
111    @type administrativeArea: None or str
112    @ivar postalCode
113    @type postalCode: None or str
114    @ivar country
115    @type country: None or str
116    @ivar electronicMailAddress
117    @type electronicMailAddress: None or str
118   
119    """
120    def __init__(self, deliveryPoints=[],city=None, administrativeArea=None, postalCode=None, country=None, electronicMailAddress=None):
121        self.deliveryPoints=deliveryPoints
122        self.city=city
123        self.administrativeArea=administrativeArea
124        self.postalCode=postalCode
125        self.country=country
126        self.electronicMailAddress=electronicMailAddress       
127
128class Telephone(object):
129   """
130   @ivar voice
131   @type voice: None or str
132   @ivar facsimile
133   @type facsimile: None or str
134   """
135   def __init__(self, voice=None, facsimile=None):
136       self.voice=voice
137       self.facsimile=facsimile
138
139class Contact(object):
140    """
141    @ivar hoursOfService
142    @type hoursOfService: None or str
143    @ivar contactInstructions
144    @type contactInstructions: None or str
145    @ivar address
146    @type address: None or Address
147    @ivar phone
148    @ivar onlineResource
149    @type onlineResource: None or OnlineResource
150    """
151    def __init__(self, hoursOfService=None, contactInstructions=None, address=None, phone=None, onlineResource=None):
152        self.hoursOfService=hoursOfService
153        self.contactInstructions=contactInstructions
154        self.address=address
155        self.phone=phone
156        self.onlineResource=onlineResource
Note: See TracBrowser for help on using the repository browser.