source: TI05-delivery/ows_framework/trunk/ows_common/is19115_subset.py @ 2477

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

Adding service_provider classes and related classes in iso19115

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    __slots__ = ['lang']
21   
22    def __init__(self, value, lang=None):
23        super(LanguageString, self).__init__(value)
24        self.lang = lang
25
26class Code(str):
27    """
28    If you wish to attach a codeSpace to a Code element use this class,
29    otherwise it can be substituted with a string
30
31    @ivar code
32    @type code: str
33    @ivar codeSpace: URI qualifying self.code
34    @type codeSpace: None or char
35
36    """
37    __slots__ = ['codeSpace']
38
39    def __init__(self, code, codeSpace=None):
40        super(Code, self).__init__(code)
41        self.codeSpace = codeSpace
42
43class Keywords(list):
44    """
45    If you wish to attach a type code to a keyword list use this class.
46    Otherwise any iterable can be used in place of Keywords.
47
48    @ivar type
49    @type type: Code
50
51    """
52    __slots__ = ['type']
53
54    def __init__(self, type=None):
55        self.type = type
56       
57class Xlink(object):
58    """
59    This class exposes all xlink:simpleLink attributes.
60
61    @ivar href: A URL
62    @type href: str
63    @ivar role
64    @type role: None or str
65    @ivar show
66    @type show: None or str
67    @ivar title
68    @type title: None or str
69    @ivar actuate
70    @type actuate: None or str
71    @ivar arcrole
72    @type arcrole: None or str
73
74    """
75    def __init__(self, href, role=None, show=None, title=None, actuate=None
76                 arcrole=None):
77        self.href = href
78        self.role = role
79        self.show = show
80        self.title = title
81        self.actuate = actuate
82        self.arcrole = arcrole
83
84class OnlineResource(Xlink):
85    pass
86
87
88#ResponsibleParty, Address, Telephone, & Contact classes added by D.Lowe
89class ResponsibleParty(object):
90    """
91    @ivar individualName
92    @type individualName: None or str
93    @ivar positionName
94    @type positionName: None or str
95    @ivar role
96    @type role: None or Code
97    @ivar contactInfo
98    @type contactInfo: None or Contact
99    """
100    def __init__(self, individualName=None, positionName=None, role=None, contactInfo=None):
101        self.individualName=individualName
102        self.positionName=positionName
103        self.role=role   
104        self.contactInfo=contactInfo
105
106class Address(object):
107    """
108    @ivar deliveryPoints
109    @type deliveryPoints: iterable of str objects
110    @ivar city
111    @type city: None or str
112    @ivar administrativeArea
113    @type administrativeArea: None or str
114    @ivar postalCode
115    @type postalCode: None or str
116    @ivar country
117    @type country: None or str
118    @ivar electronicMailAddress
119    @type electronicMailAddress: None or str
120   
121    """
122    def __init__(self, deliveryPoints=[],city=None, administrativeArea=None, postalCode=None, country=None, electronicMailAddress=None):
123        self.deliveryPoints=deliveryPoints
124        self.city=city
125        self.administrativeArea=administrativeArea
126        self.postalCode=postalCode
127        self.country=country
128        self.electronicMailAddress=electronicMailAddress       
129
130class Telephone(object):
131   """
132   @ivar voice
133   @type voice: None or str
134   @ivar facsimile
135   @type facsimile: None or str
136   """
137   def __init__(self, voice=None, facsimile=None):
138       self.voice=voice
139       self.facsimile=facsimile
140
141class Contact(object):
142    """
143    @ivar hoursOfService
144    @type hoursOfService: None or str
145    @ivar contactInstructions
146    @type contactInstructions: None or str
147    @ivar address
148    @type address: None or Address
149    @ivar phone
150    @ivar onlineResource
151    @type onlineResource: None or OnlineResource
152    """
153    def __init__(self, hoursOfService=None, contactInstructions=None, address=None, phone=None, onlineResource=None):
154        self.hoursOfService=hoursOfService
155        self.contactInstructions=contactInstructions
156        self.address=address
157        self.phone=phone
158        self.onlineResource=onlineResource
Note: See TracBrowser for help on using the repository browser.