1: <?php
2:
3: /**
4: * Description of DescriptiveMetadata
5: *
6: * @author sfrenzel
7: */
8: class IGSN_Descriptive_Metadata_Representation extends IGSN_Metadata_Base_Representation {
9:
10: const COLLECTIONTIME = 'collectionTime';
11: const SAMPLEACCESS = 'sampleAccess';
12: const RECORD = 'record';
13: const SUPPLEMENTALMETADATA = 'supplementalMetadata';
14: const CONTRIBUTORS = 'contributors';
15: const CONTRIBUTOR = 'contributor';
16: const GEOLOCATIONS = 'geoLocations';
17: const GEOLOCATION = 'geoLocation';
18: const GEOMETRY = 'GEOMETRY';
19: const GEOMETRYTYPE = 'geometryType';
20: const SRIDTYPE = 'sridType';
21: const SRIDTYPEVALUE = '4326';
22: const RESOURCETYPES = 'resourceTypes';
23: const RESOURCETYPE = 'resourceType';
24: const ALTERNATERESOURCETYPES = 'alternateResourceTypes';
25: const ALTERNATERESOURCETYPE = 'alternateResourceType';
26: const TOPONYM = 'tponym';
27: const MATERIALS = 'materials';
28: const MATERIAL = 'material';
29: const ALTERNATEMATERIALS = 'alternateMaterials';
30: const ALTERNATEMATERIAL = 'alternateMaterial';
31: const COLLECTIONMETHODS = 'collectionMethods';
32: const COLLECTIONMETHOD = 'collectionMethod';
33: const ALTERNATECOLLECTIONMETHODS = 'AlternateCollectionMethods';
34: const ALTERNATECOLLECTIONMETHOD = 'AlternateCollectionMethod';
35: const PARENTIDENTIFIER ='parentIdentifier';
36: const ODM2MEDIUM = 'http://vocabulary.odm2.org/medium/';
37:
38: public Element $identifier;
39: public Element $name;
40: public Element $parentIdentifier;
41:
42: //collectionIdentifiercontributors
43:
44: public Element $alternateIdentifiers;
45: public Element $relatedIdentifiers;
46: public Element $description;
47: public Element $registrant;
48:
49: public Element $collector;
50:
51: public Element $contributors;
52: public Element $geoLocations;
53: public Element $resourceTypes;
54: public Element $materials;
55: public Element $collectionMethods;
56: public Element $collectionTime;
57: public Element $sampleAccess;
58: public Element$supplementalMetadata;
59:
60: public function __construct() { // $this->relatedIdentifiers =NULL;
61: $this->registrant = $this->setParentElement(self::REGISTRANT);
62: }
63:
64: public function setIdentifier($identifier): void {
65: $this->identifier = $this->setbasicElement($identifier, self::TIDENTIFIER);
66: return;
67: }
68:
69: public function setIdentifier_withType($identifier, $identifierType): void {
70: $this->setIdentifier($identifier);
71: $Itype = $this->setAttribute(self::TTYPE, $identifierType);
72: $this->identifier->insertAttributes($Itype);
73: }
74:
75: public function setParentIdentifierIGSNTyped($parentIdentifier): void {
76: $this->parentIdentifier=$this->setbasicElement($parentIdentifier, self::PARENTIDENTIFIER);
77: $Itype = $this->setAttribute(self::TTYPE, self::IGSN);
78: $this->parentIdentifier->insertAttributes($Itype);
79: }
80:
81: public function setName($name): void {
82: $this->name = $this->setbasicElement($name, self::TNAME);
83: }
84:
85: public function setAlternateIdentifiers($alternateIdentifiers): void {
86: if (isset($this->alternateIdentifiers)) {
87: $this->alternateIdentifiers->insertChild($alternateIdentifiers);
88: } else {
89: $this->alternateIdentifiers = $this->setParentElement(self::ALTERNATEIDENTIFIERS);
90: $this->alternateIdentifiers->insertChild($alternateIdentifiers);
91: }
92: }
93:
94: public function setAlternateIdentifier($alternateIdentifier): void {
95: $alternateIdentifierele = $this->setbasicElement($alternateIdentifier, self::ALTERNATEIDENTIFIER);
96: $this->setAlternateIdentifiers($alternateIdentifierele);
97: }
98:
99: public function setAlternateIdentifier_type($alternateIdentifier, $type): void {
100: $alternateIdentifierele = $this->setbasicElement($alternateIdentifier, self::ALTERNATEIDENTIFIER);
101: $typeele = $this->setAttribute('identifierType', $type);
102: $alternateIdentifierele->insertAttributes($typeele);
103: $this->setAlternateIdentifiers($alternateIdentifierele);
104: }
105:
106: public function setRelatedIdentifiers($relatedIdentifiers): void {
107: if (isset($this->relatedIdentifiers)) {
108: $this->relatedIdentifiers->insertChild($relatedIdentifiers);
109: } else {
110: $this->relatedIdentifiers = $this->setParentElement(self::RELATEDIDENTIFIERS);
111: $this->relatedIdentifiers->insertChild($relatedIdentifiers);
112: }
113: }
114:
115: public function setRelatedIdentifier($relatedIdentifier): void {
116: $relatedIdentifierele = $this->setbasicElement($relatedIdentifier, self::RELATEDIDENTIFIER);
117: $this->setRelatedIdentifiers($relatedIdentifierele);
118: }
119:
120: public function setRelatedIdentifier_type($relatedIdentifier, $type): void {
121: $relatedIdentifierele = $this->setbasicElement($relatedIdentifier, self::RELATEDIDENTIFIER);
122: $typeele = $this->setAttribute(self::IDENTIFIERTYPE, $type);
123: $relatedIdentifierele->insertAttributes($typeele);
124: $this->setRelatedIdentifiers($relatedIdentifierele);
125: }
126:
127: public function setRelatedIdentifier_relation($relatedIdentifier, $relation): void {
128: $relatedIdentifierele = $this->setbasicElement($relatedIdentifier, self::RELATEDIDENTIFIER);
129: $relationele = $this->setAttribute(self::RELATIONSTYPE, $relation);
130: $relatedIdentifierele->insertAttributes($relationele);
131: $this->setRelatedIdentifiers($relatedIdentifierele);
132: }
133:
134: public function setRelatedIdentifier_type_relation($relatedIdentifier, $type, $relation): void {
135: $relatedIdentifierele = $this->setbasicElement($relatedIdentifier, self::RELATEDIDENTIFIER);
136: $typeele = $this->setAttribute(self::IDENTIFIERTYPE, $type);
137: $relatedIdentifierele->insertAttributes($typeele);
138: $relationele = $this->setAttribute(self::RELATIONSTYPE, $relation);
139: $relatedIdentifierele->insertAttributes($relationele);
140: $this->setRelatedIdentifiers($relatedIdentifierele);
141: }
142:
143: public function setDescription($description): void {
144: if(strcmp($description, '')=== 0){
145: $this->description = $this->setEmptyElement( self::DESCRIPTION);
146: }
147: $this->description = $this->setbasicElement($description, self::DESCRIPTION);
148: }
149:
150: public function setRegistrant_identifier($registrant_identifier): void {
151: $registrant_id = $this->setbasicElement($registrant_identifier, self::TIDENTIFIER);
152: $this->set2Registrant($registrant_id);
153: }
154:
155: public function setRegistrant_identifier_type($registrant_identifier, $registrant_identifiertype): void {
156: $registrant_id = $this->setbasicElement($registrant_identifier, self::TIDENTIFIER);
157: $idtype = $this->setAttribute(self::TTYPE, $registrant_identifiertype);
158: $registrant_id->insertAttributes($idtype);
159: $this->set2Registrant($registrant_id);
160: }
161:
162: public function setRegistrantName($registrant_name): void {
163: $registrantname = $this->setbasicElement($registrant_name, self::TNAME);
164: $this->set2Registrant($registrantname);
165: }
166:
167: public function setEmptyRegistrantAffiliation(): Element {
168: $registrantaffilation = $this->setParentElement(self::AFFILIATION);
169: $this->set2Registrant($registrantaffilation);
170: }
171:
172: public function setRegistrant_affiliation_identifier_name($registrant_affiliation_identifier, $registrant_affiliation_identifiertype, $registrant_affiliation_name): void {
173: $registrantaffilation = $this->setParentElement(self::AFFILIATION);
174: $registrantaffiliationidentifier = $this->setbasicElement($registrant_affiliation_identifier, self::TIDENTIFIER);
175: $idtype = $this->setAttribute(self::TTYPE, $registrant_affiliation_identifiertype);
176: $registrantaffiliationidentifier->insertAttributes($idtype);
177: $registrantaffiliationname = $this->setbasicElement($registrant_affiliation_name, self::TNAME);
178: $registrantaffilation->insertChild($registrantaffiliationidentifier);
179: $registrantaffilation->insertChild($registrantaffiliationname);
180: $this->set2Registrant($registrantaffilation);
181: }
182:
183: public function setRegistrant_affiliation_identifier($registrant_affiliation_identifier, $registrant_affiliation_identifiertype): void {
184: $registrantaffilation = $this->setParentElement(self::AFFILIATION);
185: $registrantaffiliationidentifier = $this->setbasicElement($registrant_affiliation_identifier, self::TIDENTIFIER);
186: $idtype = $this->setAttribute(self::TTYPE, $registrant_affiliation_identifiertype);
187: $registrantaffiliationidentifier->insertAttributes($idtype);
188: $registrantaffilation->insertChild($registrantaffiliationidentifier);
189: $this->set2Registrant($registrantaffilation);
190: }
191:
192: public function setRegistrant_affiliation_name($registrant_affiliation_name): void {
193: $registrantaffilation = $this->setParentElement(self::AFFILIATION);
194: $registrantaffiliationname = $this->setbasicElement($registrant_affiliation_name, self::TNAME);
195: $registrantaffilation->insertChild($registrantaffiliationname);
196: $this->set2Registrant($registrantaffilation);
197: }
198:
199: public function set2Collector($collectorElement): void {
200: if (isset($this->collector)) {
201: //if ($this->collector != NULL) {
202: $this->collector->insertChild($collectorElement);
203: } else {
204: $this->collector = $this->setParentElement(self::COLLECTOR);
205: $this->collector->insertChild($collectorElement);
206: }
207: }
208:
209: public function setCollectorName($collector_name): void {
210: $collectorname = $this->setbasicElement($collector_name, self::TNAME);
211: $this->set2Collector($collectorname);
212: }
213:
214: public function setCollector_identifier($collectorIdentifier): void {
215: $collector_identifier = $this->setbasicElement($collectorIdentifier, self::TIDENTIFIER);
216: $this->set2Collector($collector_identifier);
217: }
218:
219: public function setCollector_identifier_type($collectorIdentifier, $IdentifierType): void {
220: $collector_identifier = $this->setbasicElement($collectorIdentifier, self::TIDENTIFIER);
221: $idtype = $this->setAttribute(self::TTYPE, $IdentifierType);
222: $collector_identifier->insertAttributes($idtype);
223: $this->set2Collector($collector_identifier);
224: }
225:
226: public function set2Collector_affiliation($collectorAffiliationElement): void {
227: $collectoraffiliation = $this->setParentElement(self::AFFILIATION);
228: $collectoraffiliation->insertChild($collectorAffiliationElement);
229: $this->set2Collector($collectoraffiliation);
230: }
231:
232: public function setCollector_affiliation_identifier($affiliation_identifier): void {
233: $collector_affiliation_identifier = $this->setAffiliation_identifier($affiliation_identifier);
234: $this->set2Collector_affiliation($collector_affiliation_identifier);
235: }
236:
237: public function setCollector_affiliation_name($affiliation_name): void {
238: $collector_affiliation_name = $this->setbasicElement($affiliation_name, self::TNAME);
239: $this->set2Collector_affiliation($collector_affiliation_name);
240: }
241: public function setCollector_affiliation_name_identifier($affiliation_name,$affiliation_identifier,$affiliation_identifiertype): void {
242: $collectoraffiliation = $this->setParentElement(self::AFFILIATION);
243: $collector_affiliation_name = $this->setbasicElement($affiliation_name, self::TNAME);
244: $affiliationidentifier = $this->setbasicElement($affiliation_identifier, self::TIDENTIFIER);
245: $idtype = $this->setAttribute(self::TTYPE, $affiliation_identifiertype);
246: $affiliationidentifier->insertAttributes($idtype);
247: $collectoraffiliation->insertChild($affiliationidentifier);
248: $collectoraffiliation->insertChild($collector_affiliation_name);
249:
250: $this->set2Collector($collectoraffiliation);
251: }
252:
253:
254: public function setCollector_affiliation_identifier_type($affiliation_identifier, $affiliation_identifiertype): void {
255: $collector_affiliation_identifier = $this->setAffiliation_identifier_type($affiliation_identifier, $affiliation_identifiertype);
256: $this->set2Collector_affiliation($collector_affiliation_identifier);
257: }
258:
259: public function set2Contributors($contributor): void {
260:
261: if (isset($this->contributors)) {
262: $this->contributors->insertChild($contributor);
263:
264: return;
265: } else {
266: $this->contributors = $this->setParentElement(self::CONTRIBUTORS);
267: $this->contributors->insertChild($contributor);
268: return;
269: }
270: }
271:
272: public function setContributor(): Element {
273: $contributor = $this->setParentElement(self::CONTRIBUTOR);
274:
275: return $contributor;
276: }
277:
278: public function setContributor_identifier($contributor_identifier): void {
279: $contributor = $this->setContributor();
280: $contributoridentifier = $this->createIdentifier($contributor_identifier);
281: $contributor->insertChild($contributoridentifier);
282: $this->set2Contributors($contributor);
283: }
284:
285: public function setContributor_identifier_type($contributor_identifier, $contributor_identifier_type): void {
286: $contributor = $this->setContributor();
287: $contributoridentifier = $this->setIdentifier_type($contributor_identifier, $contributor_identifier_type);
288: $contributor->insertChild($contributoridentifier);
289: $this->set2Contributors($contributor);
290: }
291:
292: public function setContributor_name($contributor_name): void {
293: $contributor = $this->setContributor();
294: $contributorname = $this->createName($contributor_name);
295: $contributor->insertChild($contributorname);
296: $this->set2Contributors($contributor);
297: }
298: public function setContributor_nametype($contributor_name,$type): void {
299: $contributor = $this->setContributor();
300: $contributorname = $this->createName($contributor_name);
301: $contritype = $this->setAttribute('type',$type);
302: $contributor->insertAttributes($contritype);
303: $contributor->insertChild($contributorname);
304: $this->set2Contributors($contributor, $type);
305: }
306:
307: public function set2GeoLocations($geolactionelement): void {
308: if (isset($this->geoLocations)) {
309: $this->geoLocations->insertChild($geolactionelement);
310: return;
311: } else {
312: $this->geoLocations = $this->setParentElement(self::GEOLOCATIONS);
313: $this->geoLocations->insertChild($geolactionelement);
314: return;
315: }
316: }
317:
318: public function setGeoLocation(): Element {
319: $geoLocation = $this->setParentElement(self::GEOLOCATIONS);
320: return $geoLocation;
321: }
322:
323: public function setGeometry($geometry): void {
324: $geolocationelement = $this->setGeoLocation();
325: $geometryele = $this->setbasicElement($geometry, self::GEOMETRY);
326: $geolocationelement->insertChild($geometryele);
327: $this->set2GeoLocations($geolocationelement);
328: }
329:
330: public function setGeometry_type($geometry, $type): void {
331: $geolocationelement = $this->setGeoLocation();
332: $geometryele = $this->setbasicElement($geometry, self::GEOMETRY);
333: $typeele = $this->setAttribute(self::GEOMETRYTYPE, $type);
334: $geometryele->insertAttributes($typeele);
335: $geolocationelement->insertChild($geometryele);
336: $this->set2GeoLocations($geolocationelement);
337: }
338:
339: public function setGeometry_type_srid($geometry, $type, $srid = self::SRIDTYPEVALUE): void {
340: $geolocationelement = $this->setGeoLocation();
341: $geometryele = $this->setbasicElement($geometry, self::GEOMETRY);
342: $typeele = $this->setAttribute(self::GEOMETRYTYPE, $type);
343: $geometryele->insertAttributes($typeele);
344: $sridele = $this->setAttribute(self::SRIDTYPE, $srid);
345: $geometryele->insertAttributes($typeele);
346: $geometryele->insertAttributes($sridele);
347: $geolocationelement->insertChild($geometryele);
348: $this->set2GeoLocations($geolocationelement);
349: }
350:
351: public function setToponym(): Element {
352: $toponymele = $this->setParentElement(self::TOPONYM);
353: return $toponymele;
354: }
355:
356: public function setToponym_identifier($toponym_identifier): void {
357: $geolocationelement = $this->setGeoLocation();
358: $toponymele = $this->setToponym();
359: $identifierelement = $this->createIdentifier($toponym_identifier);
360: $toponymele->insertChild($identifierelement);
361: $geolocationelement->insertChild($toponymele);
362: $this->set2GeoLocations($geolocationelement);
363: }
364:
365: public function setToponym_identifier_type($toponym_identifier, $type): void {
366: $geolocationelement = $this->setGeoLocation();
367: $toponymele = $this->setToponym();
368: $identifierelement = $this->setIdentifier_type($toponym_identifier, $type);
369: $toponymele->insertChild($identifierelement);
370: $geolocationelement->insertChild($toponymele);
371: $this->set2GeoLocations($geolocationelement);
372: }
373:
374: public function setToponym_name($toponym_name): void {
375: $geolocationelement = $this->setGeoLocation();
376: $toponymele = $this->setToponym();
377: $nameelement = $this->createName($toponym_name);
378: $toponymele->insertChild($nameelement);
379: $geolocationelement->insertChild($toponymele);
380: $this->set2GeoLocations($geolocationelement);
381: }
382:
383: public function setToponym_identifier_type_name($toponym_identifier, $type, $toponym_name): void {
384: $geolocationelement = $this->setGeoLocation();
385: $toponymele = $this->setToponym();
386: $identifierelement = $this->setIdentifier_type($toponym_identifier, $type);
387: $toponymele->insertChild($identifierelement);
388: $nameelement = $this->createName($toponym_name);
389: $toponymele->insertChild($nameelement);
390: $geolocationelement->insertChild($toponymele);
391: $this->set2GeoLocations($geolocationelement);
392: }
393:
394: private function setResourceTypes($resourcetypeelement): void {
395: if (!isset($this->resourceTypes)) {
396: $this->resourceTypes = $this->setParentElement(self::RESOURCETYPES);
397: $this->resourceTypes->insertChild($resourcetypeelement);
398: } else {
399: $this->resourceTypes->insertChild($resourcetypeelement);
400: }
401: }
402:
403: public function setResourceType($resourceType): void {
404: $resourceTypeele = $this->setbasicElement($resourceType, self::RESOURCETYPE);
405: $this->setResourceTypes($resourceTypeele);
406: }
407:
408: private function setAlternateResourceTypes($alternateResourceType): void {
409: $alternateResourceTypesElement = $this->setParentElement(self::ALTERNATERESOURCETYPES);
410: $alternateResourceTypesElement->insertChild($alternateResourceType);
411: $this->setResourceTypes($alternateResourceTypesElement);
412: }
413:
414: public function setAlternateResourceType($alternateResourceType): void {
415: $alternateResourceTypeElement = $this->setbasicElement($alternateResourceType, self::ALTERNATERESOURCETYPE);
416: $this->setAlternateResourceTypes($alternateResourceTypeElement);
417: }
418:
419: private function setMaterials($materials): void {
420: if (!isset($this->materials)) {
421: $this->materials = $this->setParentElement(self::MATERIALS);
422: $this->materials->insertChild($materials);
423: } else {
424: $this->materials->insertChild($materials);
425: }
426: }
427:
428: public function setMaterial($material): void {
429: if(filter_var($material, FILTER_VALIDATE_URL)){
430: $materialenum = $material;
431: if(strcmp ($material ,'http://vocabulary.odm2.org/medium/notApplicable/')===0){
432: $materialenum = 'http://vocabulary.odm2.org/medium/other/';
433: }
434: } else {
435: echo $material;
436: if(strcmp($material,'Liquid>aqueous') ===0){
437: $materialenum = self::ODM2MEDIUM ."Liquid>aqueous/";
438: } elseif(strcmp($material, 'Liquid>organic') ===0) {
439: $materialenum = self::ODM2MEDIUM .'Liquid>organic/';
440: }elseif((strcmp($material, 'Not applicable') ===0) ) {
441: $materialenum = self::ODM2MEDIUM .'other/';
442: }
443: else{
444: $value = lcfirst($material);
445: $materialenum= self::ODM2MEDIUM . $value.'/';
446: }
447:
448:
449: }
450: $materialelement = $this->setbasicElement($materialenum, self::MATERIAL);
451: $this->setMaterials($materialelement);
452: }
453:
454: public function setAlternateMaterials(): Element {
455: $alternateMaterialselement = $this->setParentElement(self::ALTERNATEMATERIALS);
456: return $alternateMaterialselement;
457: }
458:
459: public function setAlternateMaterial($alternateMaterial): void {
460: $alternateMaterialelement = $this->setbasicElement($alternateMaterial, self::ALTERNATEMATERIAL);
461: $alternateMaterials = $this->setAlternateMaterials();
462: $alternateMaterials->insertChild($alternateMaterialelement);
463: $this->setMaterials($alternateMaterials);
464: }
465:
466: private function setCollectionMethods($collectionMethod): void {
467: if (!isset($this->collectionMethods)) {
468: $this->collectionMethods = $this->setParentElement(self::COLLECTIONMETHODS);
469: $this->collectionMethods->insertChild($collectionMethod);
470: } else {
471: $this->collectionMethods->insertChild($collectionMethod);
472: }
473: }
474:
475: public function setCollectionMethod($collectionMethod): void {
476: $collectionMethodelement = $this->setbasicElement($collectionMethod, self::COLLECTIONMETHOD);
477: $this->setCollectionMethods($collectionMethodelement);
478: }
479:
480: public function setAlternateCollectionMethods(): Element {
481: $alternateCollectionMetodselement = $this->setParentElement(self::ALTERNATECOLLECTIONMETHODS);
482: return $alternateCollectionMetodselement;
483: }
484:
485: public function setAlternateCollectionMethod($alternateCollectionMethod): void {
486: $alternateCollectionMethodelement = $this->setbasicElement($alternateCollectionMethod, self::ALTERNATEMATERIAL);
487: $alternateCollectionMethods = $this->setAlternateCollectionMethods();
488: $alternateCollectionMethods->insertChild($alternateCollectionMethodelement);
489: $this->setCollectionMethods($alternateCollectionMethods);
490: }
491:
492: public function setCollectionTime($collectionTime): void {
493: $this->collectionTime = $this->setbasicElement($collectionTime, self::COLLECTIONTIME);
494: }
495:
496: public function setSampleAccess($sampleAccess): void {
497: $this->sampleAccess = $this->setbasicElement($sampleAccess, self::SAMPLEACCESS);
498: }
499:
500: public function setSupplementalMetadata($sample): void {
501: if (isset($this->supplementalMetadata )) {
502: $this->supplementalMetadata->setValue($sample);
503: } else {
504: $this->supplementalMetadata = $this->setbasicElement($sample, self::SUPPLEMENTALMETADATA);
505: }
506: }
507:
508: public function setSample($sample): void {
509: $recordElementele = $this->setbasicElement($sample, self::RECORD);
510: $this->setSupplementalMetadata($recordElementele);
511: }
512:
513: public function getName() {
514: return $this->name;
515: }
516:
517: public function getAlternateIdentifiers() {
518: return $this->alternateIdentifiers;
519: }
520:
521: public function getRelatedIdentifiers() {
522: return $this->relatedIdentifiers;
523: }
524:
525: public function getDescription() {
526: return $this->description;
527: }
528:
529: public function getRegistrant() {
530: return $this->registrant;
531: }
532:
533: public function getCollector() {
534: return $this->collector;
535: }
536:
537: public function getContributors() {
538: return $this->contributors;
539: }
540:
541: public function getGeoLocations() {
542: return $this->geoLocations;
543: }
544:
545: public function getGeoLocation() {
546: return $this->geoLocation;
547: }
548:
549: public function getResourceTypes() {
550: return $this->resourceTypes;
551: }
552:
553: public function getMaterials() {
554: return $this->materials;
555: }
556:
557: public function getCollectionMethods() {
558: return $this->collectionMethods;
559: }
560:
561: public function getCollectionTime() {
562: return $this->collectionTime;
563: }
564:
565: public function getSampleAccess() {
566: return $this->sampleAccess;
567: }
568:
569: public function getSupplementalMetadata() {
570: return $this->supplementalMetadata;
571: }
572:
573: }
574: