コード例 #1
0
    def __init__(self, element):
        super(TimeRange, self).__init__(element)
        # Elements
        self.uom = get_uom(element.find(nspv("swe20:uom")))

        try:
            self.constraint = AllowedTimes(
                element.find(nspv("swe20:constraint/swe20:AllowedTimes"))
            )  # AllowedTimes, min=0, max=1
        except:
            self.constraint = None

        # Attributes
        self.localFrame = testXMLAttribute(element,
                                           "localFrame")  # anyURI, optional
        try:
            self.referenceTime = parser.parse(
                testXMLAttribute(element,
                                 "referenceTime"))  # dateTime, optional
        except (AttributeError, ValueError):
            self.referenceTime = None

        values = make_pair(testXMLValue(element.find(
            nspv("swe20:value"))))  # TimePosition, min=0, max=1
        self.value = [
            get_time(t, self.referenceTime, self.uom) for t in values
        ]
コード例 #2
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        super(Vector, self).__init__(element)
        # Elements
        self.coordinate     = [Coordinate(x) for x in element.findall(nspv("swe20:coordinate"))]

        # Attributes
        self.referenceFrame = testXMLAttribute(element,"referenceFrame")        # anyURI, required
        self.localFrame     = testXMLAttribute(element,"localFrame")            # anyURI, optional
コード例 #3
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     super(Matrix, self).__init__(element)
     self.elementCount   = element.find(nspv("swe20:elementCount/swe20:Count"))      # required
     self.elementType    = ElementType(element.find(nspv("swe20:elementType")))      # required
     self.encoding       = AbstractEncoding(element.find(nspv("swe20:encoding")))
     self.values         = testXMLValue(element.find(nspv("swe20:values")))
     self.referenceFrame = testXMLAttribute(element, "referenceFrame")               # anyURI, required
     self.localFrame     = testXMLAttribute(element, "localFrame")                   # anyURI, optional
コード例 #4
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.id = testXMLAttribute(element, nsp('gml:id'))
     self.privacyAct = testXMLAttribute(element, nsp('sml:privacyAct'))
     self.intellectualPropertyRights = testXMLAttribute(
         element, nsp('sml:intellectualPropertyRights'))
     self.copyRights = testXMLAttribute(element, nsp('sml:copyRights'))
     self.documentation = [
         Documentation(x) for x in element.findall(nsp("sml:documentation"))
     ]
コード例 #5
0
 def __init__(self, element):
     super(AbstractDataComponent, self).__init__(element)
     # Attributes
     self.definition = testXMLAttribute(element,
                                        "definition")  # anyURI, required
     self.updatable = get_boolean(testXMLAttribute(
         element, "updatable"))  # boolean, optional
     self.optional = get_boolean(testXMLAttribute(
         element, "optional")) or False  # boolean, default=False
コード例 #6
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.id          = testXMLAttribute(element, nsp("gml:id"))
     self.version     = testXMLValue(element.find(nsp("sml:version")))
     self.description = testXMLValue(element.find(nsp("gml:description")))
     self.date        = testXMLValue(element.find(nsp("sml:date")))
     try:
         self.contact     = Contact(element.find(nsp("sml:contact")))
     except AttributeError:
         self.contact     = None
     self.format      = testXMLValue(element.find(nsp('sml:format')))
     self.url         = testXMLAttribute(element.find(nsp('sml:onlineResource')), nsp('xlink:href'))
コード例 #7
0
 def __init__(self, element):
     self.tokenSeparator = testXMLAttribute(
         element[-1], "tokenSeparator")  # string,  required
     self.blockSeparator = testXMLAttribute(
         element[-1], "blockSeparator")  # string,  required
     self.decimalSeparator = testXMLAttribute(
         element[-1],
         "decimalSeparator") or "."  # string,  optional, default="."
     self.collapseWhiteSpaces = get_boolean(
         testXMLAttribute(element[-1], "collapseWhiteSpaces")
     ) or True  # boolean, optional, default=True
コード例 #8
0
    def __init__(self, element):
        super(Vector, self).__init__(element)
        # Elements
        self.coordinate = [
            Coordinate(x) for x in element.findall(nspv("swe20:coordinate"))
        ]

        # Attributes
        self.referenceFrame = testXMLAttribute(
            element, "referenceFrame")  # anyURI, required
        self.localFrame = testXMLAttribute(element,
                                           "localFrame")  # anyURI, optional
コード例 #9
0
 def __init__(self, element):
     super(Matrix, self).__init__(element)
     self.elementCount = element.find(
         nspv("swe20:elementCount/swe20:Count"))  # required
     self.elementType = ElementType(element.find(
         nspv("swe20:elementType")))  # required
     self.encoding = AbstractEncoding(element.find(nspv("swe20:encoding")))
     self.values = testXMLValue(element.find(nspv("swe20:values")))
     self.referenceFrame = testXMLAttribute(
         element, "referenceFrame")  # anyURI, required
     self.localFrame = testXMLAttribute(element,
                                        "localFrame")  # anyURI, optional
コード例 #10
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.id = testXMLAttribute(element, nsp("gml:id"))
     self.version = testXMLValue(element.find(nsp("sml:version")))
     self.description = testXMLValue(element.find(nsp("gml:description")))
     self.date = testXMLValue(element.find(nsp("sml:date")))
     try:
         self.contact = Contact(element.find(nsp("sml:contact")))
     except AttributeError:
         self.contact = None
     self.format = testXMLValue(element.find(nsp('sml:format')))
     self.url = testXMLAttribute(element.find(nsp('sml:onlineResource')),
                                 nsp('xlink:href'))
コード例 #11
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        super(AbstractSimpleComponent, self).__init__(element)
        # Attributes
        self.referenceFrame = testXMLAttribute(element,"referenceFrame")    # anyURI, optional
        self.axisID         = testXMLAttribute(element,"axisID")            # string, optional

        # Elements
        self.quality        = filter(None, [Quality(q) for q in [e.find('*') for e in element.findall(nspv("swe20:quality"))] if q is not None])
        try:
            self.nilValues  = NilValues(element.find(nspv("swe20:nilValues")))
        except:
            self.nilValues  = None
コード例 #12
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
    def __init__(self, element):
        # Both capabilities and characteristics contain a single swe:DataRecord element
        self.capabilities = {}
        for cap in element.findall(nsp('sml:capabilities')):
            name = testXMLAttribute(cap, "name")
            if name is not None:
                self.capabilities[name] = cap[0]

        self.characteristics = {}
        for cha in element.findall(nsp('sml:characteristics')):
            name = testXMLAttribute(cha, "name")
            if name is not None:
                self.characteristics[name] = cha[0]
コード例 #13
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        # Both capabilities and characteristics contain a single swe:DataRecord element
        self.capabilities = {}
        for cap in element.findall(nsp('sml:capabilities')):
            name = testXMLAttribute(cap, "name")
            if name is not None:
                self.capabilities[name] = cap[0]

        self.characteristics = {}
        for cha in element.findall(nsp('sml:characteristics')):
            name = testXMLAttribute(cha, "name")
            if name is not None:
                self.characteristics[name] = cha[0]
コード例 #14
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     # TODO: This only supports the sml:contact/sml:ResponsibleParty elements, but there are numerous ways to store
     # contact information here.
     self.role         = testXMLAttribute(element, nsp("xlink:role"))
     self.href         = testXMLAttribute(element, nsp("xlink:href"))
     self.organization = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:organizationName')))
     self.phone        = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:phone/sml:voice')))
     self.address      = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:deliveryPoint')))
     self.city         = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:city')))
     self.region       = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:administrativeArea')))
     self.postcode     = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:postalCode')))
     self.country      = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:country')))
     self.email        = testXMLValue(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:electronicMailAddress')))
     self.url          = testXMLAttribute(element.find(nsp('sml:ResponsibleParty/sml:contactInfo/sml:onlineResource')), nsp("xlink:href"))
コード例 #15
0
    def __init__(self, element):
        super(AbstractSimpleComponent, self).__init__(element)
        # Attributes
        self.referenceFrame = testXMLAttribute(
            element, "referenceFrame")  # anyURI, optional
        self.axisID = testXMLAttribute(element, "axisID")  # string, optional

        # Elements
        self.quality = filter(None, [
            Quality(q) for q in
            [e.find('*')
             for e in element.findall(nspv("swe20:quality"))] if q is not None
        ])
        try:
            self.nilValues = NilValues(element.find(nspv("swe20:nilValues")))
        except:
            self.nilValues = None
コード例 #16
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.history = {}
     for event_member in element.findall(nsp('sml:history/sml:EventList/sml:member')):
         name = testXMLAttribute(event_member, "name")
         if self.history.get(name) is None:
             self.history[name] = []
         for e in event_member.findall(nsp("sml:Event")):
             self.history[name].append(Event(e))
コード例 #17
0
 def __init__(self, element):
     # No call to super(), the type object will process that.
     self.name = testXMLAttribute(element, "name")
     try:
         self.content = eval(element[-1].tag.split("}")[-1])(element[-1])
     except IndexError:
         self.content = None
     except BaseException:
         raise
コード例 #18
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     # No call to super(), the type object will process that.
     self.name           = testXMLAttribute(element, "name")
     try:
         self.content    = eval(element[-1].tag.split("}")[-1])(element[-1])
     except IndexError:
         self.content    = None
     except BaseException:
         raise
コード例 #19
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.history = {}
     for event_member in element.findall(
             nsp('sml:history/sml:EventList/sml:member')):
         name = testXMLAttribute(event_member, "name")
         if self.history.get(name) is None:
             self.history[name] = []
         for e in event_member.findall(nsp("sml:Event")):
             self.history[name].append(Event(e))
コード例 #20
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        super(TimeRange, self).__init__(element)
        # Elements
        self.uom                = get_uom(element.find(nspv("swe20:uom")))

        try:
            self.constraint     = AllowedTimes(element.find(nspv("swe20:constraint/swe20:AllowedTimes"))) # AllowedTimes, min=0, max=1
        except:
            self.constraint     = None

        # Attributes
        self.localFrame         = testXMLAttribute(element,"localFrame")                                # anyURI, optional
        try:
            self.referenceTime  = parser.parse(testXMLAttribute(element,"referenceTime"))               # dateTime, optional
        except (AttributeError, ValueError):
            self.referenceTime  = None

        values                  = make_pair(testXMLValue(element.find(nspv("swe20:value"))))            # TimePosition, min=0, max=1
        self.value              = [get_time(t, self.referenceTime, self.uom) for t in values]
コード例 #21
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        super(Category, self).__init__(element)
        # Elements
        self.codeSpace      = testXMLAttribute(element.find(nspv("swe20:codeSpace")), nspv("xlink:href"))   # Reference, min=0, max=1
        self.value          = testXMLValue(element.find(nspv("swe20:value")))                               # string, min=0, max=1

        try:
            self.constraint     = AllowedTokens(element.find(nspv("swe20:constraint/swe20:AllowedTokens"))) # AllowedTokens, min=0, max=1
        except:
            self.constraint     = None
コード例 #22
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     # TODO: This only supports the sml:contact/sml:ResponsibleParty elements, but there are numerous ways to store
     # contact information here.
     self.role = testXMLAttribute(element, nsp("xlink:role"))
     self.href = testXMLAttribute(element, nsp("xlink:href"))
     self.organization = testXMLValue(
         element.find(nsp('sml:ResponsibleParty/sml:organizationName')))
     self.phone = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:phone/sml:voice')
         ))
     self.address = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:deliveryPoint'
                 )))
     self.city = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:city'
                 )))
     self.region = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:administrativeArea'
                 )))
     self.postcode = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:postalCode'
                 )))
     self.country = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:country'
                 )))
     self.email = testXMLValue(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:address/sml:electronicMailAddress'
                 )))
     self.url = testXMLAttribute(
         element.find(
             nsp('sml:ResponsibleParty/sml:contactInfo/sml:onlineResource')
         ), nsp("xlink:href"))
コード例 #23
0
    def __init__(self, element):
        super(Category, self).__init__(element)
        # Elements
        self.codeSpace = testXMLAttribute(
            element.find(nspv("swe20:codeSpace")),
            nspv("xlink:href"))  # Reference, min=0, max=1
        self.value = testXMLValue(element.find(
            nspv("swe20:value")))  # string, min=0, max=1

        try:
            self.constraint = AllowedTokens(
                element.find(nspv("swe20:constraint/swe20:AllowedTokens"))
            )  # AllowedTokens, min=0, max=1
        except:
            self.constraint = None
コード例 #24
0
ファイル: ows.py プロジェクト: roomthily/pipeline-demo
    def __init__(self, elem, namespace=DEFAULT_OWS_NAMESPACE):
        if 'name' not in elem.attrib: # This is not a valid element
            return
        self.name = elem.attrib['name']
        self.formatOptions = ['text/xml']
        parameters = []
        self.methods = []
        self.constraints = []

        for verb in elem.findall(util.nspath('DCP/HTTP/*', namespace)):
            url = util.testXMLAttribute(verb, util.nspath('href', XLINK_NAMESPACE))
            if url is not None:
                verb_constraints = [Constraint(conts, namespace) for conts in verb.findall(util.nspath('Constraint', namespace))]
                self.methods.append({'constraints' : verb_constraints, 'type' : util.xmltag_split(verb.tag), 'url': url})

        for parameter in elem.findall(util.nspath('Parameter', namespace)):
            if namespace == OWS_NAMESPACE_1_1_0:
                parameters.append((parameter.attrib['name'], {'values': [i.text for i in parameter.findall(util.nspath('AllowedValues/Value', namespace))]}))
            else:
                parameters.append((parameter.attrib['name'], {'values': [i.text for i in parameter.findall(util.nspath('Value', namespace))]}))
        self.parameters = dict(parameters)

        for constraint in elem.findall(util.nspath('Constraint', namespace)):
            self.constraints.append(Constraint(constraint, namespace))
コード例 #25
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     ReferenceGroup.__init__(self, element)
     GeneralInfoGroup.__init__(self, element)
     self.id = testXMLAttribute(element, nsp("gml:id"))
     self.date = testXMLValue(element.find(nsp('sml:date')))
     self.description = testXMLValue(element.find(nsp('gml:description')))
コード例 #26
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     Term.__init__(self, element)
     self.name = testXMLAttribute(element, "name")
コード例 #27
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
    def __init__(self, element):
        # Attributes
        self.id             = testXMLAttribute(element,"id")   # string, optional

        # Elements
        self.extention      = []                            # anyType, min=0, max=X
コード例 #28
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.name = testXMLAttribute(element, "name")
     self.interface_definition = InterfaceDefinition(
         element.find(nsp("sml:InterfaceDefinition")))
コード例 #29
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
def get_uom(element):

    uom = testXMLAttribute(element, "code")
    if uom is None:
        uom = testXMLAttribute(element, nspv("xlink:href"))
    return uom
コード例 #30
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.reason             = testXMLAttribute(element, "reason")
     self.value              = testXMLValue(element)
コード例 #31
0
def get_uom(element):

    uom = testXMLAttribute(element, "code")
    if uom is None:
        uom = testXMLAttribute(element, nspv("xlink:href"))
    return uom
コード例 #32
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     super(AbstractDataComponent, self).__init__(element)
     # Attributes
     self.definition     = testXMLAttribute(element,"definition")                        # anyURI, required
     self.updatable      = get_boolean(testXMLAttribute(element,"updatable"))            # boolean, optional
     self.optional       = get_boolean(testXMLAttribute(element,"optional")) or False    # boolean, default=False
コード例 #33
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.codeSpace = testXMLAttribute(
         element.find(nsp('sml:Term/sml:codeSpace')), nsp("xlink:href"))
     self.definition = testXMLAttribute(element.find(nsp('sml:Term')),
                                        "definition")
     self.value = testXMLValue(element.find(nsp('sml:Term/sml:value')))
コード例 #34
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     Term.__init__(self, element)
     self.name      = testXMLAttribute(element, "name")
コード例 #35
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     ReferenceGroup.__init__(self, element)
     GeneralInfoGroup.__init__(self, element)
     self.id            = testXMLAttribute(element, nsp("gml:id"))
     self.date          = testXMLValue(element.find(nsp('sml:date')))
     self.description   = testXMLValue(element.find(nsp('gml:description')))
コード例 #36
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.codeSpace  = testXMLAttribute(element.find(nsp('sml:Term/sml:codeSpace')), nsp("xlink:href"))
     self.definition = testXMLAttribute(element.find(nsp('sml:Term')), "definition")
     self.value      = testXMLValue(element.find(nsp('sml:Term/sml:value')))
コード例 #37
0
 def __init__(self, element):
     self.reason = testXMLAttribute(element, "reason")
     self.value = testXMLValue(element)
コード例 #38
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.name                 = testXMLAttribute(element, "name")
     self.interface_definition = InterfaceDefinition(element.find(nsp("sml:InterfaceDefinition")))
コード例 #39
0
ファイル: common.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.tokenSeparator         = testXMLAttribute(element[-1], "tokenSeparator")                           # string,  required
     self.blockSeparator         = testXMLAttribute(element[-1], "blockSeparator")                           # string,  required
     self.decimalSeparator       = testXMLAttribute(element[-1], "decimalSeparator") or "."                  # string,  optional, default="."
     self.collapseWhiteSpaces    = get_boolean(testXMLAttribute(element[-1], "collapseWhiteSpaces")) or True # boolean, optional, default=True
コード例 #40
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.arcrole   = testXMLAttribute(element, nsp("xlink:arcrole"))
     self.url       = testXMLAttribute(element, nsp("xlink:href"))
     self.documents = [Document(d) for d in element.findall(nsp("sml:Document"))]
コード例 #41
0
ファイル: sml.py プロジェクト: roomthily/pipeline-demo
 def __init__(self, element):
     self.arcrole = testXMLAttribute(element, nsp("xlink:arcrole"))
     self.url = testXMLAttribute(element, nsp("xlink:href"))
     self.documents = [
         Document(d) for d in element.findall(nsp("sml:Document"))
     ]
コード例 #42
0
ファイル: sml.py プロジェクト: b-cube/pipeline-demo
 def __init__(self, element):
     self.id                         = testXMLAttribute(element, nsp('gml:id'))
     self.privacyAct                 = testXMLAttribute(element, nsp('sml:privacyAct'))
     self.intellectualPropertyRights = testXMLAttribute(element, nsp('sml:intellectualPropertyRights'))
     self.copyRights                 = testXMLAttribute(element, nsp('sml:copyRights'))
     self.documentation              = [Documentation(x) for x in element.findall(nsp("sml:documentation"))]
コード例 #43
0
    def __init__(self, element):
        # Attributes
        self.id = testXMLAttribute(element, "id")  # string, optional

        # Elements
        self.extention = []  # anyType, min=0, max=X