The CUD UI provides data in two structures and 3 formats:
|
CSV |
XML |
JSON |
Flat |
Y |
Y |
Y |
Structured |
N |
Y |
Y |
The Flat data structure is used to provide data in delimited (CSV) format. It has the following characteristics:
- Multiple values are concatenated
- Metadata is not includes except in the column headers
- Encoding is not declared
It can also optionally be used for XML and JSON format.
Attribute formatted as XML using “Flat” structure
<cudSubjects>
<cudSubject>
<attributes>
<cudAttribute>
<name>solr:id</name>
<value class="string">cud:AFD01CAABED1-41BF-94DE-0EE7A42A9262</value>
</cudAttribute>
...
</attributes>
</cudSubject>
</cudSubjects>
Multi-valued attribute formatted as XML using “Flat” structure
<cudSubjects>
<cudSubject>
<attributes>
<cudAttribute>
<name>cud:cas:scoped_affiliation</name>
<value class="list">
<string>MC@EN</string>
<string>MC@EN;20090106;20120630;UAS_UniversityCard</string>
<string>MC@oucs</string>
<string>MC@oucs;20090106;20120630;cud:derived:UAS_UniversityCard:OUCS</string>
<string>MC@Computing Services</string>
<string>MC@Computing Services;20090106;20120630;cud:derived:UAS_UniversityCard:OUCS</string>
<string>Unknown@oucs</string>
<string>Unknown@oucs;;;OUCS_Registration_Affiliations</string>
<string>Unknown@Computing Services</string>
<string>Unknown@Computing Services;;;OUCS_Registration_Affiliations</string>
<string>Staff@EN</string>
<string>Staff@EN;20110110;20120630;UAS_OpenDoor</string>
<string>Staff@oucs</string>
<string>Staff@oucs;20110110;20120630;cud:derived:UAS_OpenDoor:OUCS</string>
<string>Staff@Computing Services</string>
<string>Staff@Computing Services;20110110;20120630;cud:derived:UAS_OpenDoor:OUCS</string>
</value>
</cudAttribute>
...
</attributes>
</cudSubject>
</cudSubjects>
The “Structured” data structure provides more detail as well as metadata. If you are able to consume data in this format then you are strongly encouraged to do so.
Attribute formatted as XML using “Structured” structure
<cudSubjects>
<cudSubject>
<cudId>AFD01CAA-BED1-41BF-94DE-0EE7A42A9262</cudId>
<attributes>
<cudAttribute>
<name>cud:cas:barcode7</name>
<source>cud:derived:uas_universitycard</source>
<lastUpdated>2012-04-05 08:29:00.0 UTC</lastUpdated>
<description>Barcode7 derived from barcode</description>
<value class="string">2761086</value>
<primaryKey>false</primaryKey>
</cudAttribute>
</attributes>
...
</cudSubject>
</cudSubjects>
Affiliation formatted as XML using “Structured” structure
<cudSubjects>
<cudSubject>
<cudId>AFD01CAA-BED1-41BF-94DE-0EE7A42A9262</cudId>
<affiliations>
<cudAffiliation>
<source>UAS_UniversityCard</source>
<affiliation>EN</affiliation>
<status>MC</status>
<startDate>2009-01-06 00:00:00.0 UTC</startDate>
<endDate>2012-06-29 23:00:00.0 UTC</endDate>
<lastUpdated>2012-04-05 08:27:49.0 UTC</lastUpdated>
<dateAdded>2011-12-07 09:11:25.0 UTC</dateAdded>
</cudAffiliation>
...
</affiliations>
</cudSubject>
</cudSubjects>
B.1. Class structure for “Structured” data structure
The Structured data structure can be loaded into a class structure. A description of the fields in a set of java classes appears below:
CudSubject
**
* @author rob
* @version $Revision: 155598 $
*
* The core of Cud: each person should have exactly one person document
*/
public class CudSubject implements Serializable {
private String cudId;
/**
* Field refersToCudId. A pointer to a subject, use when subjects are merged
*/
private String refersToCudId;
private List<CudAttribute> attributes;
/**
* Field affiliations. List of CudAffiliations
*/
private List<CudAffiliation> affiliations;
…
}
CudAttribute
/**
* @author rob
* @version $Revision: 155598 $
*
* Representation of an attribute stored in a CUD subject document
*/
public class CudAttribute implements Serializable {
/**
* Field name. The name of the attribute
*/
private String name;
/**
* Field sourceName. The name of the data source.
*/
private String sourceName;
/**
* Field source.
*/
private String source;
/**
* Field lastUpdated. The date the value was last updated, without the value
* necessarily being changed
*/
private Date lastUpdated;
/**
* Field dateAdded. The data that the value was added.
*/
private Date dateAdded;
/**
* Field dateDeleted. The date that the attribute was removed.
*/
private Date dateDeleted;
/**
* Field description. The description of the attribute (metadata)
*/
private String description;
/**
* Field dataType. The datatype of the attribute (not yet enforced)
*/
private String dataType;
/**
* Field value. The value of the attribute
*/
private Object value;
/**
* Field primaryKey. Whether the attribute is a primary key.
*/
private boolean primaryKey;
/**
* Field previousValues. Previous values of an attribute, added to when the value of the
* attribute changes in order to retain audit history
*/
private List<CudAttribute> previousValues;
…
}
CudAffiliation
/**
* @author rob
* @version $Revision: 155598 $
*/
public class CudAffiliation {
/**
* Field ATTRIBUTE_NAME. (value is ""cudAffiliation"")
*/
public static final String ATTRIBUTE_NAME = "cudAffiliation";
/**
* Field source. Data source name of the affiliation
*/
private String source;
/**
* Field affiliation. Affiliated unit code or name
*/
private String affiliation;
/**
* Field status. Staff/Student etc.
*/
private String status;
/**
* Field startDate.
*/
private Date startDate;
/**
* Field endDate.
*/
private Date endDate;
/**
* Field lastUpdated.
*/
private Date lastUpdated;
/**
* Field dateAdded.
*/
private Date dateAdded;
/**
* Field dateDeleted.
*/
private Date dateDeleted;
…
}