import UniversalTranslator UT = UniversalTranslator import paradigms P = paradigms import string def phrasify (s): return string.split(s, ".") abstract = phrasify("""A digital raster graphic (DRG) is a scanned image of a U S Geological Survey (USGS) topographic map. The scanned image includes all map collar information. The image inside the map neatline is georeferenced to the surface of the Earth. The DRG can be used to collect, review, and revise other digital data, especially digital line graphs (DLG). When the DRG is combined with other digital products, such as digital orthophoto quadrangles (DOQ) or digital elevation models (DEM), the resulting image provides additional visual information for the extraction and revision of base cartographic information. The USGS is producing DRG's of the 1:24,000-,1:24,000/1:25,000-, 1:63,360- (Alaska), 1:100,000-, and 1:250,000-scale topographic map series""") purpose = phrasify("""The DRG is used for validating digital line graphs (DLG's) and for DLG data collection and revision. The DRG can help assess the completeness of digital data from other mapping agencies. It can also be used to produce "hybrid" products. These include combined DRG's and DOQ's for revising and collecting digital data, DRG's and DEM's for creating shaded-relief DRG's, and combinations of DRG, DOQ, and DLG data. Although a standard DRG is an effective mapping tool, its full potential for digital production is realized in combination with other digital data""") themeKeywords = ["digital elevation model", "DEM", "digital terrain model", "contour line", "digital contours", "DOQ", "digital orthophoto", "digital orthophotoquad", "digital image map", "aerial photograph", "paper map", "map", "digital line graph", "U.S. Public Land Survey System", "hydrography", "transportation", "topographic", "Universal Transverse Mercator", "UTM", "scanner", "raster", "digital image"] constantPlaceKeywords = ["US", "United States"] temporalKeywords = ["true ground conditions"] originators = ["U.S. Geological Survey", "USGS", "Stephen P. Teale Data Center"] buckets = { "adl:geographic-locations" : UT.Bucket( "spatial", UT.standardSpatialOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/1.5.1", P.Spatial_BoxCoordinatesNoCrossing( "ingest", "ocode", "n_b_coord", "s_b_coord", "e_b_coord", "w_b_coord", UT.Cardinality("1")))), "adl:dates" : UT.Bucket( "temporal", UT.standardTemporalOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/1.3/9.1.1", P.Temporal_IntegerYear( "ingest", "ocode", "year", UT.Cardinality("1")))), "adl:types" : UT.Bucket( "hierarchical", UT.standardHierarchicalOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/1.1/8.6", P.Hierarchical_Constant( "ingest", "ocode", "ADL Object Type Thesaurus", ["cartographic works", "maps"], UT.Cardinality("1")))), "adl:formats" : UT.Bucket( "hierarchical", UT.standardHierarchicalOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/6.4.2.1.1", P.Hierarchical_Constant( "ingest", "ocode", "ADL Object Format Thesaurus", ["Online", "Image", "TIFF"], UT.Cardinality("1")))), "adl:subject-related-text" : UT.Bucket( "textual", UT.standardTextualOperators, P.Adaptor_Concatenation({ "tag:fgdc.gov,2003:csdgm/1.2.1" : # ABSTRACT P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), abstract), "tag:fgdc.gov,2003:csdgm/1.2.2" : # PURPOSE P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), purpose), "tag:fgdc.gov,2003:csdgm/1.1/8.4" : # TITLE P.Textual_LikeSubstring( "ingest", "ocode", "title", UT.Cardinality("1"), P.TextUtils.mappings.uppercaseAlphanumericOthersToWhitespace, P.TextUtils.deleteLists.keepAll, "UPPER"), "tag:fgdc.gov,2003:csdgm/1.6.1.2" : # ASSIGNED TERMS... P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), themeKeywords), "tag:fgdc.gov,2003:csdgm/1.6.2.2" : P.Adaptor_Concatenation({ "constants" : P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), constantPlaceKeywords), "mapname" : P.Textual_LikeSubstring( "ingest", "ocode", "mapname", UT.Cardinality("1")), "state" : P.Textual_LikeSubstring( "ingest", "ocode", "state", UT.Cardinality("1"))}), "tag:fgdc.gov,2003:csdgm/1.6.4.2" : P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), temporalKeywords)})), "adl:titles" : UT.Bucket( "textual", UT.standardTextualOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/1.1/8.4", P.Textual_LikeSubstring( "ingest", "ocode", "title", UT.Cardinality("1"), P.TextUtils.mappings.uppercaseAlphanumericOthersToWhitespace, P.TextUtils.deleteLists.keepAll, "UPPER"))), "adl:assigned-terms" : UT.Bucket( "textual", UT.standardTextualOperators, P.Adaptor_Concatenation({ "tag:fgdc.gov,2003:csdgm/1.6.1.2" : P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), themeKeywords), "tag:fgdc.gov,2003:csdgm/1.6.2.2" : P.Adaptor_Concatenation({ "constants" : P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), constantPlaceKeywords), "mapname" : P.Textual_LikeSubstring( "ingest", "ocode", "mapname", UT.Cardinality("1")), "state" : P.Textual_LikeSubstring( "ingest", "ocode", "state", UT.Cardinality("1"))}), "tag:fgdc.gov,2003:csdgm/1.6.4.2" : P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), temporalKeywords)})), "adl:originators" : UT.Bucket( "textual", UT.standardTextualOperators, P.Adaptor_Constant( "tag:fgdc.gov,2003:csdgm/1.1/8.1", P.Textual_Constant( "ingest", "ocode", UT.Cardinality("1"), originators))), "adl:identifiers" : UT.Bucket( "identification", UT.standardIdentificationOperators, P.Identification_String( "ingest", "ocode", "ocode", ["USGS DRG ocode"], UT.Cardinality("1"))) } translator = UT.Translator(buckets) def translate (): return translator.translate(constraint, vocabularies)