Skip to content

Commit

Permalink
Updated namespace urls
Browse files Browse the repository at this point in the history
  • Loading branch information
IKCAP committed Aug 20, 2024
1 parent 2efe723 commit 0220293
Show file tree
Hide file tree
Showing 16 changed files with 3,206 additions and 3,351 deletions.
20 changes: 4 additions & 16 deletions pylipd/classes/chrondata.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,19 +134,13 @@ def to_json(self):
if len(self.measurementTables):
data["measurementTable"] = []
for value_obj in self.measurementTables:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["measurementTable"].append(obj)

if len(self.modeledBy):
data["model"] = []
for value_obj in self.modeledBy:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["model"].append(obj)

for key in self.misc:
Expand All @@ -164,17 +158,11 @@ def from_json(data) -> 'ChronData':
self.id = pvalue
elif key == "measurementTable":
for value in pvalue:
if type(value) is dict:
obj = DataTable.from_json(value)
else:
obj = value
obj = DataTable.from_json(value)
self.measurementTables.append(obj)
elif key == "model":
for value in pvalue:
if type(value) is dict:
obj = Model.from_json(value)
else:
obj = value
obj = Model.from_json(value)
self.modeledBy.append(obj)
else:
self.set_non_standard_property(key, pvalue)
Expand Down
95 changes: 19 additions & 76 deletions pylipd/classes/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -523,71 +523,47 @@ def to_json(self):
if len(self.chronData):
data["chronData"] = []
for value_obj in self.chronData:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["chronData"].append(obj)

if len(self.creators):
data["creator"] = []
for value_obj in self.creators:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["creator"].append(obj)

if len(self.fundings):
data["funding"] = []
for value_obj in self.fundings:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["funding"].append(obj)

if len(self.investigators):
data["investigator"] = []
for value_obj in self.investigators:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["investigator"].append(obj)

if len(self.paleoData):
data["paleoData"] = []
for value_obj in self.paleoData:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["paleoData"].append(obj)

if len(self.publications):
data["pub"] = []
for value_obj in self.publications:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["pub"].append(obj)

if self.archiveType:
value_obj = self.archiveType
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["archiveType"] = obj

if self.changeLog:
value_obj = self.changeLog
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["changelog"] = obj

if self.collectionName:
Expand All @@ -607,10 +583,7 @@ def to_json(self):

if self.contributor:
value_obj = self.contributor
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["dataContributor"] = obj

if self.dataSource:
Expand All @@ -625,10 +598,7 @@ def to_json(self):

if self.location:
value_obj = self.location
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["geo"] = obj

if self.name:
Expand Down Expand Up @@ -675,17 +645,11 @@ def from_json(data) -> 'Dataset':
self.archiveType = obj
elif key == "changelog":
value = pvalue
if type(value) is dict:
obj = ChangeLog.from_json(value)
else:
obj = value
obj = ChangeLog.from_json(value)
self.changeLog = obj
elif key == "chronData":
for value in pvalue:
if type(value) is dict:
obj = ChronData.from_json(value)
else:
obj = value
obj = ChronData.from_json(value)
self.chronData.append(obj)
elif key == "collectionName":
value = pvalue
Expand All @@ -701,17 +665,11 @@ def from_json(data) -> 'Dataset':
self.compilationNest = obj
elif key == "creator":
for value in pvalue:
if type(value) is dict:
obj = Person.from_json(value)
else:
obj = value
obj = Person.from_json(value)
self.creators.append(obj)
elif key == "dataContributor":
value = pvalue
if type(value) is dict:
obj = Person.from_json(value)
else:
obj = value
obj = Person.from_json(value)
self.contributor = obj
elif key == "dataSetName":
value = pvalue
Expand All @@ -731,28 +689,19 @@ def from_json(data) -> 'Dataset':
self.datasetId = obj
elif key == "funding":
for value in pvalue:
if type(value) is dict:
obj = Funding.from_json(value)
else:
obj = value
obj = Funding.from_json(value)
self.fundings.append(obj)
elif key == "geo":
value = pvalue
if type(value) is dict:
obj = Location.from_json(value)
else:
obj = value
obj = Location.from_json(value)
self.location = obj
elif key == "googleSpreadSheetKey":
value = pvalue
obj = value
self.spreadsheetLink = obj
elif key == "investigator":
for value in pvalue:
if type(value) is dict:
obj = Person.from_json(value)
else:
obj = value
obj = Person.from_json(value)
self.investigators.append(obj)
elif key == "notes":
value = pvalue
Expand All @@ -764,17 +713,11 @@ def from_json(data) -> 'Dataset':
self.originalDataUrl = obj
elif key == "paleoData":
for value in pvalue:
if type(value) is dict:
obj = PaleoData.from_json(value)
else:
obj = value
obj = PaleoData.from_json(value)
self.paleoData.append(obj)
elif key == "pub":
for value in pvalue:
if type(value) is dict:
obj = Publication.from_json(value)
else:
obj = value
obj = Publication.from_json(value)
self.publications.append(obj)
else:
self.set_non_standard_property(key, pvalue)
Expand Down
10 changes: 2 additions & 8 deletions pylipd/classes/datatable.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,7 @@ def to_json(self):
if len(self.variables):
data["columns"] = []
for value_obj in self.variables:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["columns"].append(obj)

if self.fileName:
Expand Down Expand Up @@ -174,10 +171,7 @@ def from_json(data) -> 'DataTable':
self.id = pvalue
elif key == "columns":
for value in pvalue:
if type(value) is dict:
obj = Variable.from_json(value)
else:
obj = value
obj = Variable.from_json(value)
self.variables.append(obj)
elif key == "filename":
value = pvalue
Expand Down
10 changes: 2 additions & 8 deletions pylipd/classes/funding.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,7 @@ def to_json(self):
if len(self.investigators):
data["investigator"] = []
for value_obj in self.investigators:
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["investigator"].append(obj)

if self.fundingAgency:
Expand Down Expand Up @@ -206,10 +203,7 @@ def from_json(data) -> 'Funding':
self.grants.append(obj)
elif key == "investigator":
for value in pvalue:
if type(value) is dict:
obj = Person.from_json(value)
else:
obj = value
obj = Person.from_json(value)
self.investigators.append(obj)
else:
self.set_non_standard_property(key, pvalue)
Expand Down
20 changes: 4 additions & 16 deletions pylipd/classes/interpretation.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,34 +380,22 @@ def to_json(self):

if self.seasonality:
value_obj = self.seasonality
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["seasonality"] = obj

if self.seasonalityGeneral:
value_obj = self.seasonalityGeneral
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["seasonalityGeneral"] = obj

if self.seasonalityOriginal:
value_obj = self.seasonalityOriginal
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["seasonalityOriginal"] = obj

if self.variable:
value_obj = self.variable
if hasattr(value_obj, "to_json"):
obj = value_obj.to_json()
else:
obj = value_obj
obj = value_obj.to_json()
data["variable"] = obj

if self.variableDetail:
Expand Down
32 changes: 32 additions & 0 deletions pylipd/classes/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(self):
self.geometryType: str = None
self.latitude: str = None
self.locationName: str = None
self.locationType: str = None
self.longitude: str = None
self.notes: str = None
self.ocean: str = None
Expand Down Expand Up @@ -123,6 +124,12 @@ def from_data(id, data) -> 'Location':
if "@value" in val:
obj = val["@value"]
self.siteName = obj

elif key == "hasType":
for val in value:
if "@value" in val:
obj = val["@value"]
self.locationType = obj
else:
for val in value:
obj = None
Expand Down Expand Up @@ -242,6 +249,16 @@ def to_data(self, data={}):
data[self.id]["hasLocationName"] = [obj]


if self.locationType:
value_obj = self.locationType
obj = {
"@value": value_obj,
"@type": "literal",
"@datatype": "http://www.w3.org/2001/XMLSchema#string"
}
data[self.id]["hasType"] = [obj]


if self.longitude:
value_obj = self.longitude
obj = {
Expand Down Expand Up @@ -361,6 +378,11 @@ def to_json(self):
obj = value_obj
data["locationName"] = obj

if self.locationType:
value_obj = self.locationType
obj = value_obj
data["type"] = obj

if self.longitude:
value_obj = self.longitude
obj = value_obj
Expand Down Expand Up @@ -450,6 +472,10 @@ def from_json(data) -> 'Location':
value = pvalue
obj = value
self.siteName = obj
elif key == "type":
value = pvalue
obj = value
self.locationType = obj
else:
self.set_non_standard_property(key, pvalue)

Expand Down Expand Up @@ -530,6 +556,12 @@ def getLocationName(self) -> str:
def setLocationName(self, locationName:str):
self.locationName = locationName

def getLocationType(self) -> str:
return self.locationType

def setLocationType(self, locationType:str):
self.locationType = locationType

def getLongitude(self) -> str:
return self.longitude

Expand Down
Loading

0 comments on commit 0220293

Please sign in to comment.