Project

General

Profile

« Previous | Next » 

Revision 91

Added support for quoted values in XPaths

View differences:

scripts/lib/xpath.py
75 75
            
76 76
            if not parser.str_('/'): break
77 77
        
78
        if parser.str_('='): set_value(tree, parser.re(r'[\w.|]*'))
78
        if parser.str_('='):
79
            if parser.str_('"'):
80
                value = parser.re(r'[^"]*')
81
                parser.str_('"', required=True)
82
            else: value = parser.re(r'[\w.|]*')
83
            set_value(tree, value)
79 84
        
80 85
        # Expand * abbrs
81 86
        for i in reversed(xrange(len(tree))):
mappings/VegX-VegBank.organisms.csv
52 52
"/*ID->/*s/plotObservation->/*s/communityDetermination[*ID]/communityConcepts/communityConcept/name","/*_ID/observation/commClass/commInterpretation/*_ID/commConcept/commDescription"
53 53
"/*ID->/*s/plotObservation/*ID->/*s/project/title","/*_ID/observation/*_ID/project/projectName"
54 54
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/area","/*_ID/observation/*_ID/plot/area"
55
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/country","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=area|country|territory])/placeName"
56
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/county","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=Geographic Name])/placeName"
55
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/country","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""area|country|territory""])/placeName"
56
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/county","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""Geographic Name])/placeName"
57 57
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/county","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=county])/placeName"
58 58
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/geospatial/CoordinateUncertaintyInMeters","/*_ID/observation/*_ID/plot/locationAccuracy"
59 59
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/geospatial/DecimalLatitude","/*_ID/observation/*_ID/plot/realLatitude"
......
73 73
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/simpleUserdefined[name=majorGeo]/value","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=continent])/placeName"
74 74
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/slopeAspect","/*_ID/observation/*_ID/plot/slopeAspect"
75 75
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/slopeGradient","/*_ID/observation/*_ID/plot/slopeGradient"
76
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/state","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=Geographic Name])/placeName"
77
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/state","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=region|state|province])/placeName"
76
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/state","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""Geographic Name""])/placeName"
77
"/*ID->/*s/plotObservation/*UniqueIdentifierID->/*s/plot/state","/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""region|state|province""])/placeName"
78 78
"/*ID->/*s/plotObservation/obsEndDate","/*_ID/observation/obsEndDate"
79 79
"/*ID->/*s/plotObservation/obsStartDate","/*_ID/observation/obsStartDate"
80 80
"/*ID->/*s/plotObservation/obsStartDate/_date/day","/*_ID/observation/obsStartDate/_date/day"
mappings/joins/NYBG-VegBank.organisms.csv
22 22
YearCollected,/*_ID/observation/obsStartDate/_date/year
23 23
MonthCollected,/*_ID/observation/obsStartDate/_date/month
24 24
DayCollected,/*_ID/observation/obsStartDate/_date/day
25
Country,/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=area|country|territory])/placeName
26
StateProvince,/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=region|state|province])/placeName
25
Country,"/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""area|country|territory""])/placeName"
26
StateProvince,"/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""region|state|province""])/placeName"
27 27
County,/*_ID/observation/*_ID/plot/place(/*_ID/namedPlace[placeSystem=county])/placeName
28 28
Locality,/*_ID/observation/*_ID/plot/place/*_ID/namedPlace/placeDescription
29 29
Longitude,/*_ID/observation/*_ID/plot/realLongitude
mappings/joins/SALVIAS-VegBank.plots.csv
2 2
project,/*_ID/project/projectName
3 3
plot_code,"/{*_ID/plot/authorPlotCode,authorObsCode}"
4 4
major_geo,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=continent])/placeName
5
country,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=area|country|territory])/placeName
6
pol1,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=region|state|province])/placeName
5
country,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""area|country|territory""])/placeName"
6
pol1,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""region|state|province""])/placeName"
7 7
pol2,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=county])/placeName
8 8
locality_description,/*_ID/plot/place/*_ID/namedPlace/placeDescription
9 9
lat_decimal,/*_ID/plot/realLatitude
mappings/VegX-VegBank.plots.csv
20 20
->/*s/communityDetermination[*ID]/communityConcepts/communityConcept/name,/commClass/commInterpretation/*_ID/commConcept/commDescription
21 21
/*ID->/*s/project/title,/*_ID/project/projectName
22 22
/*UniqueIdentifierID->/*s/plot/area,/*_ID/plot/area
23
/*UniqueIdentifierID->/*s/plot/country,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=area|country|territory])/placeName
24
/*UniqueIdentifierID->/*s/plot/county,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=Geographic Name])/placeName
23
/*UniqueIdentifierID->/*s/plot/country,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""area|country|territory""])/placeName"
24
/*UniqueIdentifierID->/*s/plot/county,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""Geographic Name])/placeName"
25 25
/*UniqueIdentifierID->/*s/plot/county,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=county])/placeName
26 26
/*UniqueIdentifierID->/*s/plot/geospatial/CoordinateUncertaintyInMeters,/*_ID/plot/locationAccuracy
27 27
/*UniqueIdentifierID->/*s/plot/geospatial/DecimalLatitude,/*_ID/plot/realLatitude
......
41 41
/*UniqueIdentifierID->/*s/plot/simpleUserdefined[name=majorGeo]/value,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=continent])/placeName
42 42
/*UniqueIdentifierID->/*s/plot/slopeAspect,/*_ID/plot/slopeAspect
43 43
/*UniqueIdentifierID->/*s/plot/slopeGradient,/*_ID/plot/slopeGradient
44
/*UniqueIdentifierID->/*s/plot/state,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=Geographic Name])/placeName
45
/*UniqueIdentifierID->/*s/plot/state,/*_ID/plot/place(/*_ID/namedPlace[placeSystem=region|state|province])/placeName
44
/*UniqueIdentifierID->/*s/plot/state,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""Geographic Name""])/placeName"
45
/*UniqueIdentifierID->/*s/plot/state,"/*_ID/plot/place(/*_ID/namedPlace[placeSystem=""region|state|province""])/placeName"
46 46
/obsEndDate,/obsEndDate
47 47
/obsStartDate,/obsStartDate
48 48
/obsStartDate/_date/day,/obsStartDate/_date/day

Also available in: Unified diff