adiwg-mdtranslator 2.9.2 → 2.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -8
- data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +179 -160
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_albers.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_azimuthEquidistant.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equidistantConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_equirectangular.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_generalVertical.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_gnomonic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertConic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_lambertEqualArea.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_mercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_millerCylinder.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_modifiedAlaska.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_obliqueMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_orthographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polarStereo.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_polyconic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_robinson.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_sinusoidal.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_spaceOblique.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_stereographic.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_transverseMercator.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/mapProjections/projection_vanDerGrinten.rb +1 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_citation.rb +14 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_codeSet.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_contact.rb +36 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_digitalForm.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_distribution.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entity.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityAttribute.rb +5 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_entityOverview.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_enumerated.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_fgdc.rb +2 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geodeticReference.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_geologicAge.rb +6 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_horizontalReference.rb +3 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_identification.rb +58 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +36 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_lineage.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_localSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapCoordinateInfo.rb +51 -12
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapGridSystem.rb +46 -9
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapLocalPlanar.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_mapProjection.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_metadataInfo.rb +10 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_methodology.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_offlineOption.rb +16 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_onlineOption.rb +13 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_orderProcess.rb +9 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb +21 -4
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_process.rb +8 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_publication.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_quality.rb +14 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_range.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_raster.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_security.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_series.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_source.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_spatialDomain.rb +32 -8
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonClass.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +20 -5
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonomy.rb +8 -2
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_transferInfo.rb +4 -1
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalAltitude.rb +12 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_verticalDepth.rb +9 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/version.rb +2 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/mdJson_validator.rb +13 -16
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_additionalDocumentation.rb +55 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_address.rb +85 -85
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_allocation.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_associatedResource.rb +91 -92
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +212 -212
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attributeGroup.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_bearingDistanceResolution.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_boundingBox.rb +11 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_citation.rb +17 -17
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_constraint.rb +26 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +13 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coordinateResolution.rb +8 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageDescription.rb +77 -77
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataDictionary.rb +9 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +54 -54
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +35 -35
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dimension.rb +70 -70
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distribution.rb +15 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_distributor.rb +53 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domain.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_domainItem.rb +5 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_duration.rb +92 -91
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entity.rb +10 -10
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +28 -18
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityForeignKey.rb +58 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityIndex.rb +52 -53
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_extent.rb +70 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_featureCollection.rb +64 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_format.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_funding.rb +9 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb +7 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb +12 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicResolution.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geologicAge.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryCollection.rb +63 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb +84 -84
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb +50 -49
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +115 -100
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +85 -82
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_graphic.rb +78 -78
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +61 -56
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_identifier.rb +72 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_imageDescription.rb +106 -107
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keyword.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_keywordObject.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_legalConstraint.rb +55 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_lineage.rb +87 -83
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_locale.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_maintenance.rb +73 -74
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_mdJson.rb +11 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_measure.rb +56 -55
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_medium.rb +88 -88
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadata.rb +106 -105
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataInfo.rb +4 -3
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_metadataRepository.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_obliqueLinePoint.rb +7 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_onlineResource.rb +60 -61
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_orderProcess.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_party.rb +57 -57
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_phone.rb +49 -51
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +6 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_projectionParameters.rb +31 -30
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_referenceSystemParameters.rb +16 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_releasability.rb +53 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +15 -13
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceType.rb +46 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceUsage.rb +95 -95
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_responsibleParty.rb +67 -67
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_schema.rb +47 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scope.rb +47 -47
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_scopeDescription.rb +68 -63
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_securityConstraint.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_series.rb +38 -38
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialReference.rb +6 -5
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialRepresentation.rb +77 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb +8 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb +71 -72
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicSystem.rb +46 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +118 -116
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_temporalExtent.rb +48 -46
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInstant.rb +8 -8
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timeInterval.rb +50 -50
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +21 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +86 -75
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_valueRange.rb +4 -4
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorObject.rb +45 -45
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +45 -33
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb +28 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb +59 -59
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_voucher.rb +43 -43
- data/lib/adiwg/mdtranslator/readers/mdReaders.rb +6 -2
- data/lib/adiwg/mdtranslator/version.rb +9 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_entityAttribute.rb +3 -3
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_featureConstraint.rb +50 -46
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_multiplicity.rb +53 -43
- data/lib/adiwg/mdtranslator/writers/iso19110/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/mdWriters.rb +58 -58
- data/lib/adiwg/mdtranslator.rb +177 -165
- data/lib/adiwg/mdtranslator_cli.rb +8 -3
- metadata +2 -2
@@ -5,65 +5,69 @@
|
|
5
5
|
# ... all constraints need to be expressed as character strings
|
6
6
|
|
7
7
|
# History:
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
8
|
+
# Stan Smith 2018-02-14 enhance constraint formatting
|
9
|
+
# Stan Smith 2017-02-03 refactored for mdJson/mdTranslator 2.0
|
10
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
11
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
12
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
13
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
13
14
|
# Stan Smith 2014-12-02 original script
|
14
15
|
|
15
16
|
module ADIWG
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
module Mdtranslator
|
18
|
+
module Writers
|
19
|
+
module Iso19110
|
19
20
|
|
20
|
-
|
21
|
+
class FC_Constraint
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
def initialize(xml, responseObj)
|
24
|
+
@xml = xml
|
25
|
+
@hResponseObj = responseObj
|
26
|
+
end
|
26
27
|
|
27
|
-
|
28
|
+
def writeXML(conType, hConstraint)
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
@xml.tag!('gfc:FC_Constraint') do
|
31
|
+
@xml.tag!('gfc:description') do
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
# find type of constraint (primary key or index)
|
34
|
+
case conType
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
s += hConstraint.to_s
|
36
|
+
# primary keys
|
37
|
+
when 'pk'
|
38
|
+
s = 'PRIMARY KEY ' + hConstraint.to_s
|
39
39
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
40
|
+
# indexes
|
41
|
+
when 'index'
|
42
|
+
if hConstraint[:duplicate]
|
43
|
+
indexType = 'DUPLICATE'
|
44
|
+
else
|
45
|
+
indexType = 'UNIQUE'
|
46
|
+
end
|
47
|
+
s = indexType + ' INDEX ' + hConstraint[:indexCode]
|
48
|
+
s += ' ON ' + hConstraint[:attributeNames].to_s
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
50
|
+
# foreign keys
|
51
|
+
when 'fk'
|
52
|
+
s = 'FK'
|
53
|
+
hConstraint[:fkLocalAttributes].each do |attribute|
|
54
|
+
s += '_' + attribute
|
55
|
+
end
|
56
|
+
s += ' FOREIGN KEY '
|
57
|
+
s += hConstraint[:fkLocalAttributes].to_s
|
58
|
+
s += ' REFERENCES ' + hConstraint[:fkReferencedEntity]
|
59
|
+
s += hConstraint[:fkReferencedAttributes].to_s
|
56
60
|
|
57
|
-
|
61
|
+
end
|
58
62
|
|
59
|
-
|
63
|
+
@xml.tag!('gco:CharacterString', s)
|
60
64
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
+
end
|
66
|
+
end # gfc:FC_Constraint tag
|
67
|
+
end # writeXML
|
68
|
+
end # FC_Constraint class
|
65
69
|
|
66
|
-
|
67
|
-
|
68
|
-
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
69
73
|
end
|
@@ -5,62 +5,72 @@
|
|
5
5
|
# ... cardinality is defined between tables, not for attributes.
|
6
6
|
# ... documentation by NOAA and modelManager suggest best practice for
|
7
7
|
# ... propertyType is to default to 1.
|
8
|
+
# ... upper not provided a value in examples but XSD required it to be present
|
8
9
|
# ... I assume this is using cardinality like optionality.
|
9
10
|
# ... therefore ...
|
10
|
-
# ... lower = 0
|
11
|
-
# ... lower = 1
|
12
|
-
# ... upper
|
11
|
+
# ... lower = 0 if allowNull = false
|
12
|
+
# ... lower = 1 if allowNull = true
|
13
|
+
# ... upper = 1 if mustBeUnique = true
|
14
|
+
# ... upper = 9 if mustBeUnique = false with isInfinite="true"
|
13
15
|
|
14
16
|
# History:
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
17
|
+
# Stan Smith 2018-02-14 add isInfinite="true" to upper multiplicity
|
18
|
+
# Stan Smith 2017-02-02 refactored for mdJson/mdTranslator 2.0
|
19
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
20
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
21
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (responseObj)
|
22
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
20
23
|
# Stan Smith 2014-12-02 original script.
|
21
24
|
|
22
25
|
module ADIWG
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
+
module Mdtranslator
|
27
|
+
module Writers
|
28
|
+
module Iso19110
|
26
29
|
|
27
|
-
|
30
|
+
class Multiplicity
|
28
31
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
def initialize(xml, responseObj)
|
33
|
+
@xml = xml
|
34
|
+
@hResponseObj = responseObj
|
35
|
+
end
|
33
36
|
|
34
|
-
|
37
|
+
def writeXML(hAttribute)
|
35
38
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
39
|
+
# xml for iso classes Multiplicity and MultiplicityRange
|
40
|
+
# ISO 19110-2 rule
|
41
|
+
# ... "If this is an attribute or operation, the default cardinality is 1"
|
42
|
+
minCard = 1
|
43
|
+
maxCard = 9
|
44
|
+
if hAttribute[:allowNull]
|
45
|
+
minCard = 0
|
46
|
+
end
|
47
|
+
if hAttribute[:mustBeUnique]
|
48
|
+
maxCard = 1
|
49
|
+
end
|
44
50
|
|
45
|
-
|
46
|
-
|
51
|
+
# xml for iso classes Multiplicity and MultiplicityRange
|
52
|
+
@xml.tag!('gco:Multiplicity') do
|
47
53
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
54
|
+
@xml.tag!('gco:range') do
|
55
|
+
@xml.tag!('gco:MultiplicityRange') do
|
56
|
+
@xml.tag!('gco:lower') do
|
57
|
+
@xml.tag!('gco:Integer', minCard)
|
58
|
+
end
|
59
|
+
@xml.tag!('gco:upper') do
|
60
|
+
if maxCard == 1
|
61
|
+
@xml.tag!('gco:UnlimitedInteger', 1)
|
62
|
+
else
|
63
|
+
@xml.tag!('gco:UnlimitedInteger', {'isInfinite'=>'true'}, 9)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
58
68
|
|
59
|
-
|
60
|
-
|
61
|
-
|
69
|
+
end # gco:Multiplicity tag
|
70
|
+
end # writeXML
|
71
|
+
end # Multiplicity class
|
62
72
|
|
63
|
-
|
64
|
-
|
65
|
-
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
66
76
|
end
|
@@ -1,4 +1,6 @@
|
|
1
1
|
# History
|
2
|
+
# Stan Smith 2018-02-14 refactored cardinality
|
3
|
+
# Stan Smith 2018-02-14 refactored constraints
|
2
4
|
# Stan Smith 2017-03-10 refactored for mdJson/mdTranslator 2.0
|
3
5
|
# Josh Bradley
|
4
6
|
|
@@ -7,7 +9,7 @@ module ADIWG
|
|
7
9
|
module Writers
|
8
10
|
module Iso19110
|
9
11
|
|
10
|
-
VERSION = '1.1.
|
12
|
+
VERSION = '1.1.1'
|
11
13
|
|
12
14
|
end
|
13
15
|
end
|
@@ -31,7 +31,7 @@ module ADIWG
|
|
31
31
|
end
|
32
32
|
json.dataType hAttribute[:dataType]
|
33
33
|
json.allowNull hAttribute[:allowNull]
|
34
|
-
json.
|
34
|
+
json.mustBeUnique hAttribute[:mustBeUnique]
|
35
35
|
json.units hAttribute[:unitOfMeasure]
|
36
36
|
json.unitsResolution hAttribute[:measureResolution]
|
37
37
|
json.isCaseSensitive hAttribute[:isCaseSensitive]
|
@@ -1,72 +1,72 @@
|
|
1
1
|
# MdTranslator - controller for evaluating and directing writers
|
2
2
|
|
3
3
|
# History:
|
4
|
-
#
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
4
|
+
# Stan Smith 2016-11-14 refactored for mdTranslator 2.0.0
|
5
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
6
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
7
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
8
|
+
# Stan Smith 2015-03-04 changed method of setting $WriterNS
|
9
|
+
# Stan Smith 2012-12-16 generalized handleWriter to use :writerName
|
10
|
+
# Stan Smith 2014-12-11 original script
|
11
11
|
|
12
12
|
module ADIWG
|
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
|
-
|
13
|
+
module Mdtranslator
|
14
|
+
module Writers
|
15
|
+
|
16
|
+
def self.handleWriter(intObj, hResponseObj)
|
17
|
+
|
18
|
+
# use ':writerRequested' from hResponseObj to build directory path to writer
|
19
|
+
# writer's high-level folder must be placed in 'lib/adiwg/mdtranslator/writers/'
|
20
|
+
# writer's code must must be in folder named '{writer}'
|
21
|
+
# '{writer}' must contain a module named '{writer}_writer.rb'
|
22
|
+
# '{writer}_writer.rb' must have a method named 'startWriter()'
|
23
|
+
# 'startWriter()' must pass two parameters (intObj, hResponseObj)
|
24
|
+
# all writer modules and classes must remain in their private namespace
|
25
|
+
# writer namespace is 'ADIWG::Mdtranslator::Writers::{writer}'
|
26
|
+
|
27
|
+
# the writer's high-level
|
28
|
+
thisDir = File.dirname(File.expand_path(__FILE__))
|
29
|
+
writerDir = File.join(thisDir, hResponseObj[:writerRequested])
|
30
|
+
if File.directory?(writerDir)
|
31
|
+
|
32
|
+
# writer folder
|
33
|
+
writerModule = File.join(writerDir, hResponseObj[:writerRequested] + '_writer')
|
34
|
+
require writerModule
|
35
|
+
|
36
|
+
# writer namespace
|
37
|
+
writerNS = hResponseObj[:writerRequested].dup
|
38
|
+
writerNS[0] = writerNS[0].upcase
|
39
|
+
|
40
|
+
# pass internal object and hResponseObj to the writer
|
41
|
+
hResponseObj[:writerOutput] = ADIWG::Mdtranslator::Writers.const_get(writerNS).startWriter(intObj, hResponseObj)
|
42
|
+
|
43
|
+
else
|
44
|
+
hResponseObj[:writerMessages] << "ERROR: Requested writer '#{hResponseObj[:writerRequested]}' cannot be found."
|
45
|
+
hResponseObj[:writerPass] = false
|
46
|
+
end
|
39
47
|
|
40
|
-
|
41
|
-
hResponseObj[:writerOutput] = ADIWG::Mdtranslator::Writers.const_get(writerNS).startWriter(intObj, hResponseObj)
|
48
|
+
return hResponseObj
|
42
49
|
|
43
|
-
|
44
|
-
hResponseObj[:writerMessages] << "Requested writer '#{hResponseObj[:writerRequested]}' cannot be found."
|
45
|
-
hResponseObj[:writerPass] = false
|
46
|
-
end
|
50
|
+
end
|
47
51
|
|
48
|
-
|
52
|
+
# return writer readme text
|
53
|
+
# this is called from the Rails API
|
54
|
+
def self.get_writer_readme(writer)
|
49
55
|
|
56
|
+
thisDir = File.dirname(File.expand_path(__FILE__))
|
57
|
+
path = File.join(thisDir, writer, 'readme.md')
|
58
|
+
if File.exist?(path)
|
59
|
+
file = File.open(path, 'r')
|
60
|
+
readmeText = file.read
|
61
|
+
file.close
|
62
|
+
return readmeText
|
63
|
+
else
|
64
|
+
return 'Readme file not found'
|
50
65
|
end
|
51
66
|
|
52
|
-
|
53
|
-
# this is called from the Rails API
|
54
|
-
def self.get_writer_readme(writer)
|
55
|
-
|
56
|
-
thisDir = File.dirname(File.expand_path(__FILE__))
|
57
|
-
path = File.join(thisDir, writer, 'readme.md')
|
58
|
-
if File.exist?(path)
|
59
|
-
file = File.open(path, 'r')
|
60
|
-
readmeText = file.read
|
61
|
-
file.close
|
62
|
-
return readmeText
|
63
|
-
else
|
64
|
-
return 'Readme file not found'
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
67
|
+
end
|
68
68
|
|
69
|
-
|
70
|
-
|
69
|
+
end
|
70
|
+
end
|
71
71
|
end
|
72
72
|
|