Changeset 556


Ignore:
Timestamp:
06/29/10 12:21:22 (14 years ago)
Author:
oschonef
Message:
  • re-work virtual collection properties
    • remove visibility and origin
    • add purpose, reproducibility and reproducibility_notice and preliminary generated_by
  • update / re-formatted XML schema to reflect these changes
  • change internal XML representation of virtual collections
  • update virtual collection registry query language to be able to search new properties
  • update CMDI representation of virtual collections
  • clean up Resource-set handling and virtual collection validator

HEADS UP: changes are not backwards compatible and require new database layout

Location:
VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/VirtualCollectionRegistry.java

    r531 r556  
    129129            new VirtualCollectionValidator();
    130130        validator.validate(vc);
    131 
    132131        try {
    133132            EntityManager em = datastore.getEntityManager();
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/VirtualCollectionRegistryMarshaller.java

    r503 r556  
    222222        for (Resource resource : vc.getResources()) {
    223223            output.writeStartElement(NS_CMDI, "ResourceProxy");
    224             output.writeAttribute("id", resource.getIdForXml());
     224            output.writeAttribute("id", "r" + resource.getId());
    225225            output.writeStartElement(NS_CMDI, "ResourceType");
    226226            switch (resource.getType()) {
     
    259259        output.writeCharacters(df.format(vc.getCreationDate()));
    260260        output.writeEndElement(); // "CreationDate" element
    261         output.writeStartElement(NS_CMDI, "Visibility");
    262         switch (vc.getVisibility()) {
    263         case ADVERTISED:
    264             output.writeCharacters("advertised");
    265             break;
    266         case NON_ADVERTISED:
    267             output.writeCharacters("non-advertised");
    268             break;
    269         } // switch
    270         output.writeEndElement(); // "Visibility" element
    271         if (vc.getOrigin() != null) {
    272             output.writeStartElement(NS_CMDI, "Origin");
    273             output.writeCharacters(vc.getOrigin());
    274             output.writeEndElement(); // "Visibility" element
    275         }
    276261        if (vc.getCreator() != null) {
    277262            Creator creator = vc.getCreator();
     
    299284            }
    300285        }
     286        if (vc.getPurpose() != null) {
     287            output.writeStartElement(NS_CMDI, "Purpose");
     288            switch (vc.getPurpose()) {
     289            case RESEARCH:
     290                output.writeCharacters("research");
     291                break;
     292            case REFERENCE:
     293                output.writeCharacters("reference");
     294                break;
     295            case SAMPLE:
     296                output.writeCharacters("sample");
     297                break;
     298            case FUTURE_USE:
     299                output.writeCharacters("future-use");
     300                break;
     301            } // switch (purpose)
     302            output.writeEndElement(); // "Purpose" element
     303        }
     304        if (vc.getReproducibility() != null) {
     305            output.writeStartElement(NS_CMDI, "Reproducibility");
     306            switch (vc.getReproducibility()) {
     307            case INTENDED:
     308                output.writeCharacters("intended");
     309                break;
     310            case FLUCTUATING:
     311                output.writeCharacters("fluctuating");
     312                break;
     313            case UNTENDED:
     314                output.writeCharacters("untended");
     315                break;
     316            } // switch (purpose)
     317            output.writeEndElement(); // "Reproducibility" element
     318        }
     319        if (vc.getReproducibilityNotice() != null) {
     320            output.writeStartElement(NS_CMDI, "ReproducibilityNotice");
     321            output.writeCharacters(vc.getReproducibilityNotice());
     322            output.writeEndElement(); // "ReproducibilityNotice" element
     323        }
    301324        output.writeEndElement(); // "VirtualCollection" element
    302325        output.writeEndElement(); // "Components" element
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/Resource.java

    r509 r556  
    1111import javax.xml.bind.annotation.XmlAccessType;
    1212import javax.xml.bind.annotation.XmlAccessorType;
    13 import javax.xml.bind.annotation.XmlAttribute;
    1413import javax.xml.bind.annotation.XmlElement;
    15 import javax.xml.bind.annotation.XmlID;
    1614import javax.xml.bind.annotation.XmlType;
    1715
     
    5048    }
    5149
    52     @XmlID
    53     @XmlAttribute(name = "id")
    54     public String getIdForXml() {
    55         return "r" + id;
    56     }
    57 
    5850    public void setType(ResourceType type) {
    5951        if (type == null) {
     
    8072    }
    8173
    82     protected int getSignature() {
    83         return new HashCodeBuilder(799, 51).append(type).append(ref)
    84                 .toHashCode();
     74    @Override
     75    public boolean equals(Object other) {
     76        if ((other != null) && (other instanceof Resource)) {
     77            final Resource r = (Resource) other;
     78            return r.type.equals(this.type) && r.ref.equals(this.ref);
     79        }
     80        return false;
     81    }
     82   
     83    @Override
     84    public int hashCode() {
     85        return new HashCodeBuilder(799, 51)
     86            .append(type)
     87            .append(ref)
     88            .toHashCode();
    8589    }
    8690
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/VirtualCollection.java

    r511 r556  
    22
    33import java.util.Date;
    4 import java.util.HashMap;
    54import java.util.LinkedHashSet;
    65import java.util.Set;
     
    7170@XmlRootElement(name = "VirtualCollection")
    7271@XmlAccessorType(XmlAccessType.NONE)
    73 @XmlType(propOrder = { "name", "description", "creationDate", "visibility",
    74                        "type", "origin", "creator", "resources" })
     72@XmlType(propOrder = { "name", "description", "creationDate", "type",
     73                       "creator", "purpose", "reproducibility",
     74                       "reproducibilityNotice", "resources", "generatedBy" })
    7575@XmlSeeAlso({ Creator.class,
     76              GeneratedBy.class,
    7677              Resource.class,
    7778              PersistentIdentifier.class })
     
    9192        DEAD
    9293    } // enum State
    93     @XmlType(namespace = "urn:x-vcr:virtualcollection:visibility")
    94     @XmlEnum(String.class)
    95     public static enum Visibility {
    96         @XmlEnumValue("advertised")
    97         ADVERTISED,
    98         @XmlEnumValue("non-advertised")
    99         NON_ADVERTISED;
    100     } // enum Visibility
    10194    @XmlType(namespace = "urn:x-vcr:virtualcollection:type")
    10295    @XmlEnum(String.class)
     
    10699        @XmlEnumValue("intensional")
    107100        INTENSIONAL
     101    }
     102    @XmlType(namespace = "urn:x-vcr:virtualcollection:purpose")
     103    @XmlEnum(String.class)
     104    public static enum Purpose {
     105        @XmlEnumValue("research")
     106        RESEARCH,
     107        @XmlEnumValue("reference")
     108        REFERENCE,
     109        @XmlEnumValue("sample")
     110        SAMPLE,
     111        @XmlEnumValue("future-use")
     112        FUTURE_USE
     113    }
     114    @XmlType(namespace = "urn:x-vcr:virtualcollection:reproducability")
     115    @XmlEnum(String.class)
     116    public static enum Reproducibility {
     117        @XmlEnumValue("intended")
     118        INTENDED,
     119        @XmlEnumValue("fluctuating")
     120        FLUCTUATING,
     121        @XmlEnumValue("untended")
     122        UNTENDED
    108123    }
    109124    @Id
     
    135150    @Temporal(TemporalType.DATE)
    136151    private Date creationDate;
    137     @Column(name = "visibility")
    138     @Enumerated(EnumType.ORDINAL)
    139     private Visibility visibility = Visibility.ADVERTISED;
    140152    @Column(name = "type")
    141153    @Enumerated(EnumType.ORDINAL)
    142154    private Type type = Type.EXTENSIONAL;
    143     @Column(name = "origin")
    144     private String origin;
    145155    @Embedded
    146156    private Creator creator;
     157    @Column(name = "purpose")
     158    @Enumerated(EnumType.ORDINAL)
     159    private Purpose purpose;
     160    @Column(name = "reproducibility")
     161    @Enumerated(EnumType.ORDINAL)
     162    private Reproducibility reproducibility;
     163    @Column(name = "reproducibility_notice")
     164    private String reproducibilityNotice;
    147165    @OneToMany(cascade = CascadeType.ALL,
    148                fetch = FetchType.LAZY)
     166               fetch = FetchType.LAZY,
     167               orphanRemoval = true)
    149168    @JoinColumn(name = "vc_id",
    150169                nullable = false)
    151170    @OrderBy("id")
    152171    private Set<Resource> resources = new LinkedHashSet<Resource>();
     172    @Embedded
     173    private GeneratedBy generatedby;
    153174    @Column(name = "created",
    154175            nullable = false,
     
    259280    }
    260281
    261     public void setVisibility(Visibility visibility) {
    262         if (visibility == null) {
    263             throw new NullPointerException("visibility == null");
    264         }
    265         this.visibility = visibility;
    266     }
    267 
    268     @XmlElement(name = "Visibility")
    269     public Visibility getVisibility() {
    270         return visibility;
    271     }
    272 
    273282    public void setType(Type style) {
    274283        if (style == null) {
     
    283292    }
    284293
    285     public void setOrigin(String origin) {
    286         this.origin = origin;
    287     }
    288 
    289     @XmlElement(name = "Origin")
    290     public String getOrigin() {
    291         return origin;
    292     }
    293 
    294294    public void setCreator(Creator creator) {
    295295        this.creator = creator;
     
    301301    }
    302302
     303    public void setPurpose(Purpose purpose) {
     304        this.purpose = purpose;
     305    }
     306   
     307    @XmlElement(name = "Purpose")
     308    public Purpose getPurpose() {
     309        return purpose;
     310    }
     311   
     312    public void setReproducibility(Reproducibility reproducibility) {
     313        this.reproducibility = reproducibility;
     314    }
     315
     316    @XmlElement(name = "Reproducability")
     317    public Reproducibility getReproducibility() {
     318        return reproducibility;
     319    }
     320
     321    public void setReproducibilityNotice(String reproducibilityNotice) {
     322        this.reproducibilityNotice = reproducibilityNotice;
     323    }
     324
     325    @XmlElement(name = "ReproducibilityNotice")
     326    public String getReproducibilityNotice() {
     327        return reproducibilityNotice;
     328    }
     329
    303330    @XmlElementWrapper(name = "Resources")
    304     @XmlElements({ @XmlElement(name = "ResourceProxy", type = Resource.class) })
     331    @XmlElements({ @XmlElement(name = "Resource", type = Resource.class) })
    305332    public Set<Resource> getResources() {
    306333        return resources;
     334    }
     335
     336    public void setGeneratedBy(GeneratedBy generatedby) {
     337        this.generatedby = generatedby;
     338    }
     339
     340    @XmlElement(name = "GeneratedBy")
     341    public GeneratedBy getGeneratedBy() {
     342        return generatedby;
    307343    }
    308344
     
    333369        this.setDescription(vc.getDescription());
    334370        this.setCreationDate(vc.getCreationDate());
    335         this.setVisibility(vc.getVisibility());
    336371        this.setType(vc.getType());
    337         this.setOrigin(vc.getOrigin());
    338372        Creator c = vc.getCreator();
    339373        if (c != null) {
     
    344378            this.creator = null;
    345379        }
    346 
    347         HashMap<Integer, Resource> old_res =
    348             new HashMap<Integer, Resource>(this.resources.size());
    349         for (Resource r : this.resources) {
    350             old_res.put(r.getSignature(), r);
    351 
    352         }
    353         HashMap<Integer, Resource> new_res =
    354             new HashMap<Integer, Resource>(vc.getResources().size());
    355         for (Resource r : vc.getResources()) {
    356             new_res.put(r.getSignature(), r);
    357         }
    358         for (Resource r : new_res.values()) {
    359             if (!old_res.containsKey(r.getSignature())) {
    360                 resources.add(r);
    361             }
    362         }
    363         for (Resource r : old_res.values()) {
    364             if (!new_res.containsKey(r.getSignature())) {
    365                 resources.remove(r);
    366             }
    367         }
     380        this.setPurpose(vc.getPurpose());
     381        this.setReproducibility(vc.getReproducibility());
     382        this.setReproducibilityNotice(vc.getReproducibilityNotice());
     383
     384        // add all new resources to set
     385        this.resources.addAll(vc.resources);
     386        // purge all deleted members
     387        this.resources.retainAll(vc.resources);
    368388    }
    369389
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/model/VirtualCollectionValidator.java

    r503 r556  
    11package eu.clarin.cmdi.virtualcollectionregistry.model;
    22
    3 import java.util.HashMap;
     3import java.util.HashSet;
     4import java.util.Set;
    45
    56import eu.clarin.cmdi.virtualcollectionregistry.VirtualCollectionRegistryException;
     
    78
    89public class VirtualCollectionValidator {
    9     private HashMap<Integer, Resource> uniqueResources =
    10         new HashMap<Integer, Resource>();
    11     private HashMap<String, Resource> uniqueResourceRefs =
    12         new HashMap<String, Resource>();
     10    private Set<String> uniqueResourceRefs = new HashSet<String>(512);
    1311
    1412    public void validate(VirtualCollection vc)
     
    2725        }
    2826        for (Resource resource : vc.getResources()) {
    29             int signature = resource.getSignature();
    30             if (uniqueResources.containsKey(signature)) {
    31                 throw new VirtualCollectionRegistryUsageException(
    32                         "collection contains non-unique resources");
    33             }
    34             uniqueResources.put(signature, resource);
    3527            String ref = resource.getRef();
    3628            if ((ref == null) || ref.trim().isEmpty()) {
     
    3830                        "collection contains resource with empty ResourceRef");
    3931            }
    40             if (uniqueResourceRefs.containsKey(ref)) {
     32            if (uniqueResourceRefs.contains(ref)) {
    4133                throw new VirtualCollectionRegistryUsageException(
    4234                        "collection contains non-unique ResourceRefs");
    4335            }
    44             uniqueResourceRefs.put(ref, resource);
     36            uniqueResourceRefs.add(ref);
    4537        }
    4638    }
    4739
    4840    private void reset() {
    49         uniqueResources.clear();
    5041        uniqueResourceRefs.clear();
    5142    }
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/query/ASTPredicate.java

    r522 r556  
    5555            sb.append("vc_state");
    5656            break;
     57        case QueryParserConstants.VC_PURPOSE:
     58            sb.append("vc_purpose");
     59            break;
     60        case QueryParserConstants.VC_REPRODUCIBILITY:
     61            sb.append("vc_reproducibility");
     62            break;
    5763        case QueryParserConstants.VC_MODIFIED:
    5864            sb.append("vc_modified");
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/java/eu/clarin/cmdi/virtualcollectionregistry/query/WhereClauseBuilder.java

    r522 r556  
    132132        case QueryParserConstants.VC_STATE:
    133133            predicate = makeStatePredicate(data,
     134                    node.getOperator(), node.getValue());
     135            break;
     136        case QueryParserConstants.VC_PURPOSE:
     137            predicate = makePurposePredicate(data,
     138                    node.getOperator(), node.getValue());
     139            break;
     140        case QueryParserConstants.VC_REPRODUCIBILITY:
     141            predicate = makeReproducibilityPredicate(data,
    134142                    node.getOperator(), node.getValue());
    135143            break;
     
    208216                return data.getBuilder().notEqual(attribute, state);
    209217            }
     218        default:
     219            throw new InternalError("bad operator");
     220        } // switch (operator)
     221    }
     222
     223    private static Predicate makePurposePredicate(Data data, int operator,
     224            String value) {
     225        VirtualCollection.Purpose purpose = null;
     226        if ("research".equalsIgnoreCase(value)) {
     227            purpose = VirtualCollection.Purpose.RESEARCH;
     228        } else if ("reference".equalsIgnoreCase(value)) {
     229            purpose = VirtualCollection.Purpose.REFERENCE;
     230        } else if ("sample".equalsIgnoreCase(value)) {
     231            purpose = VirtualCollection.Purpose.SAMPLE;
     232        } else if ("future-use".equalsIgnoreCase(value)) {
     233            purpose = VirtualCollection.Purpose.FUTURE_USE;
     234        } else {
     235            throw new InternalError("bad value");
     236        }
     237        Expression<VirtualCollection.Purpose> attribute =
     238            data.getRoot().get(VirtualCollection_.purpose);
     239        switch (operator) {
     240        case QueryParserConstants.EQ:
     241            return data.getBuilder().equal(attribute, purpose);
     242        case QueryParserConstants.NE:
     243            return data.getBuilder().notEqual(attribute, purpose);
     244        default:
     245            throw new InternalError("bad operator");
     246        } // switch (operator)
     247    }
     248
     249    private static Predicate makeReproducibilityPredicate(Data data,
     250            int operator, String value) {
     251        VirtualCollection.Reproducibility reproducability = null;
     252        if ("intended".equalsIgnoreCase(value)) {
     253            reproducability = VirtualCollection.Reproducibility.INTENDED;
     254        } else if ("fluctuating".equalsIgnoreCase(value)) {
     255            reproducability = VirtualCollection.Reproducibility.FLUCTUATING;
     256        } else if ("untended".equalsIgnoreCase(value)) {
     257            reproducability = VirtualCollection.Reproducibility.UNTENDED;
     258        } else {
     259            throw new InternalError("bad value");
     260        }
     261        Expression<VirtualCollection.Reproducibility> attribute =
     262            data.getRoot().get(VirtualCollection_.reproducibility);
     263        switch (operator) {
     264        case QueryParserConstants.EQ:
     265            return data.getBuilder().equal(attribute, reproducability);
     266        case QueryParserConstants.NE:
     267            return data.getBuilder().notEqual(attribute, reproducability);
    210268        default:
    211269            throw new InternalError("bad operator");
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/jjtree/eu/clarin/cmdi/virtualcollectionregistry/query/QueryParser.jjt

    r522 r556  
    66    VISITOR           = true;
    77}
    8 
    98PARSER_BEGIN(QueryParser)
    109package eu.clarin.cmdi.virtualcollectionregistry.query;
    11 
    1210public class QueryParser {
    1311    public QueryParser(String s) {
     
    1614} // class QueryParser
    1715PARSER_END(QueryParser)
    18 
    1916/*
    20   (vc.)name:         STRING, EQ, NE
    21   (vc.)desciption:   STRING, EQ, NE
    22   (vc.)created:      DATE,   EQ, NE, GT, GE, LT, LE
    23   {vc.}modified:     DATE,   EQ, NE, GT, GE, LT, LE
    24   (vc.)state:        { "public", "private", "deleted"}, EQ, NE
     17  (vc.)name:           STRING, EQ, NE
     18  (vc.)desciption:     STRING, EQ, NE
     19  (vc.)created:        ISO-DATE, EQ, NE, GT, GE, LT, LE
     20  {vc.}modified:       ISO-DATE, EQ, NE, GT, GE, LT, LE
     21  (vc.)state:          { "public", "private", "deleted" }, EQ, NE
     22  {vc.}purpose:        { "research", "reference",
     23                         "sample", "future-use" } EQ, NE
     24  {vc.}reproducability { "intended", "fluctuating", "untended"} EQ, NE
    2525  (cr.)creator:      STRING, EQ, NE
    2626  {cr.}email:        STRING, EQ, NE
    2727  {cr.}organization: STRING, EQ, NE
    2828*/
    29 
    3029SKIP: {
    3130    " "
     
    3433    | "\r"
    3534}
    36 
    3735TOKEN: {
    3836      <VC_NAME: "name">
     
    4139    | <VC_MODIFIED: "modified">
    4240    | <VC_STATE: "state">
     41    | <VC_PURPOSE: "purpose">
     42    | <VC_REPRODUCIBILITY: "reproducibility">
    4343    | <CR_NAME: "creator">
    4444    | <CR_ORGANIZATION: "organization">
     
    5151    | <GE: ">=">
    5252    | <LT: "<">
    53     | <LE: "<="> 
     53    | <LE: "<=">
    5454    | <LPAREN: "(">
    5555    | <RPAREN: ")">
     
    5757    | <STATE_PRIVATE: "private">
    5858    | <STATE_DELETED: "deleted">
     59    | <PURPOSE_RESEARCH: "research">
     60    | <PURPOSE_REFERENCE: "reference">
     61    | <PURPOSE_SAMPLE: "sample">
     62    | <PURPOSE_FUTURE_USE: "future-use">
     63    | <REPRODUCIBILITY_INTENDED: "intended">
     64    | <REPRODUCIBILITY_FLUCTUATING: "fluctuating">
     65    | <REPRODUCIBILITY_UNTENDED: "untended">
    5966    | <#DIGIT: ["0"-"9"]>
    6067    | <ISO_DATE: <DIGIT> <DIGIT> <DIGIT> <DIGIT> "-"
     
    6370                 <DIGIT> <DIGIT> ":"
    6471                 <DIGIT> <DIGIT> ":"
    65                  <DIGIT> <DIGIT> "Z">   
     72                 <DIGIT> <DIGIT> "Z">
    6673    | <QUOTED_STRING: "\"" (~["\""])+ "\"" >
    6774}
    68 
    6975ASTStart start() #Start : {
    7076}
     
    7379    { return jjtThis; }
    7480}
    75 
    7681private void expressionOr() : {
    7782}
     
    7984    (expressionAnd() (<OR> expressionAnd())*) #Or(>1)
    8085}
    81 
    8286private void expressionAnd() : {
    8387}
     
    8589    (term() (<AND> term())*) #And(>1)
    8690}
    87 
    8891private void term() : {
    8992}
     
    9295    | (<LPAREN> expressionOr() <RPAREN>)
    9396}
    94 
    9597private void predicate() #Predicate : {
    9698    Token attribute = null;
     
    123125         | operator = <LE> )
    124126         value = <ISO_DATE> )
     127     | ( attribute = <VC_PURPOSE>
     128        ( operator = <EQ>
     129        | operator = <NE> )
     130        ( value = <PURPOSE_RESEARCH>
     131        | value = <PURPOSE_REFERENCE>
     132        | value = <PURPOSE_SAMPLE>
     133        | value = <PURPOSE_FUTURE_USE> ) )
     134     | ( attribute = <VC_REPRODUCIBILITY>
     135        ( operator = <EQ>
     136        | operator = <NE> )
     137        ( value = <REPRODUCIBILITY_INTENDED>
     138        | value = <REPRODUCIBILITY_FLUCTUATING>
     139        | value = <REPRODUCIBILITY_UNTENDED> ) )
    125140    )
    126141    {
     
    128143            throw new ParseException("internal error while parsing query");
    129144        }
    130 
    131145        // strip quotes from QUOTED_STRING
    132146        String v = value.image;
     
    134148            v = v.substring(1, v.length() - 1);
    135149        }
    136 
    137150        jjtThis.setAttribute(attribute.kind);
    138151        jjtThis.setOperator(operator.kind);
  • VirtualCollectionRegistry/trunk/VirtualCollectionRegistry/src/main/resources/META-INF/VirtualCollection.xsd

    r507 r556  
    11<?xml version="1.0" encoding="UTF-8"?>
    2 <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
     2<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
     3  elementFormDefault="qualified">
    34
    4         <xs:element name="VirtualCollection" type="VirtualCollectionType" />
     5  <xs:element name="VirtualCollections">
     6    <xs:complexType>
     7      <xs:sequence maxOccurs="unbounded">
     8        <xs:element ref="VirtualCollection" />
     9      </xs:sequence>
     10      <xs:attribute name="totalCount" type="xs:integer" />
     11      <xs:attribute name="offset" type="xs:integer" />
     12      <xs:attribute name="result">
     13        <xs:simpleType>
     14          <xs:restriction base="xs:string">
     15            <xs:enumeration value="full" />
     16            <xs:enumeration value="partial" />
     17          </xs:restriction>
     18        </xs:simpleType>
     19      </xs:attribute>
     20    </xs:complexType>
     21  </xs:element>
    522
    6         <xs:element name="VirtualCollections" type="VirtualCollectionsType" />
    7 
    8         <xs:complexType name="VirtualCollectionsType">
    9                 <xs:sequence maxOccurs="unbounded">
    10                         <xs:element ref="VirtualCollection" />
    11                 </xs:sequence>
    12                 <xs:attribute name="totalCount" type="xs:integer" />
    13                 <xs:attribute name="offset" type="xs:integer" />
    14                 <xs:attribute name="result">
    15                         <xs:simpleType>
    16                                 <xs:restriction base="xs:string">
    17                                         <xs:enumeration value="full" />
    18                                         <xs:enumeration value="partial" />
    19                                 </xs:restriction>
    20                         </xs:simpleType>
    21                 </xs:attribute>
    22         </xs:complexType>
    23 
    24         <xs:complexType name="VirtualCollectionType">
    25                 <xs:sequence>
    26                         <xs:element name="Name" type="xs:string" />
    27                         <xs:element minOccurs="0" name="Description" type="xs:string" />
    28                         <xs:element minOccurs="0" name="CreationDate" type="xs:date" />
    29                         <xs:element minOccurs="0" name="Visibility" type="VisibilityType" />
    30                         <xs:element name="Type" type="TypeType" />
    31                         <xs:element minOccurs="0" name="Origin" type="xs:string" />
    32                         <xs:element minOccurs="0" name="Creator" type="CreatorType" />
    33                         <xs:element name="Resources" type="ResourcesType" />
    34                 </xs:sequence>
    35                 <xs:attribute name="id" type="xs:long" use="optional" />
    36         <xs:attribute name="persistentId" type="xs:string" use="optional" />
    37                 <xs:attribute name="state" type="xs:string" use="optional" />
    38         </xs:complexType>
    39 
    40 
    41         <xs:complexType name="ResourcesType">
    42                 <xs:sequence maxOccurs="unbounded">
    43                         <xs:element name="ResourceProxy" type="ResourceType" />
    44                 </xs:sequence>
    45         </xs:complexType>
    46 
    47         <xs:complexType name="ResourceType">
    48                 <xs:sequence>
    49                         <xs:element name="ResourceType" type="ResourceTypeType" />
    50                         <xs:element name="ResourceRef" type="ResourceRefType" />
    51                 </xs:sequence>
    52                 <xs:attribute name="id" type="xs:ID" use="required" />
    53         </xs:complexType>
    54 
    55         <xs:complexType name="CreatorType">
    56                 <xs:sequence>
    57                         <xs:element name="Name" type="xs:string" />
    58                         <xs:element minOccurs="0" name="Email" type="xs:string" />
    59                         <xs:element minOccurs="0" name="Organisation" type="xs:string" />
    60                 </xs:sequence>
    61                 <xs:attribute name="ref" type="xs:IDREF" />
    62         </xs:complexType>
    63 
    64         <xs:simpleType name="ResourceTypeType">
    65                 <xs:restriction base="xs:string">
    66                         <xs:enumeration value="Metadata" />
    67                         <xs:enumeration value="Resource" />
    68                 </xs:restriction>
    69         </xs:simpleType>
    70 
    71         <xs:simpleType name="ResourceRefType">
    72                 <xs:restriction base="xs:anyURI" />
    73         </xs:simpleType>
    74 
    75         <xs:simpleType name="VisibilityType">
    76                 <xs:restriction base="xs:string">
    77                         <xs:enumeration value="advertised" />
    78                         <xs:enumeration value="non-advertised" />
    79                 </xs:restriction>
    80         </xs:simpleType>
    81 
    82         <xs:simpleType name="TypeType">
    83                 <xs:restriction base="xs:string">
    84                         <xs:enumeration value="extensional" />
    85                         <xs:enumeration value="intensional" />
    86                 </xs:restriction>
    87         </xs:simpleType>
    88 
     23  <xs:element name="VirtualCollection">
     24    <xs:complexType>
     25      <xs:sequence>
     26        <xs:element name="Name" type="xs:string" />
     27        <xs:element minOccurs="0" name="Description" type="xs:string" />
     28        <xs:element minOccurs="0" name="CreationDate" type="xs:date" />
     29        <xs:element name="Type">
     30          <xs:simpleType>
     31            <xs:restriction base="xs:string">
     32              <xs:enumeration value="extensional" />
     33              <xs:enumeration value="intensional" />
     34            </xs:restriction>
     35          </xs:simpleType>
     36        </xs:element>
     37        <xs:element minOccurs="0" name="Creator">
     38          <xs:complexType>
     39            <xs:sequence>
     40              <xs:element name="Name" type="xs:string" />
     41              <xs:element minOccurs="0" name="Email" type="xs:string" />
     42              <xs:element minOccurs="0" name="Organisation"
     43                type="xs:string" />
     44            </xs:sequence>
     45            <xs:attribute name="ref" type="xs:IDREF" />
     46          </xs:complexType>
     47        </xs:element>
     48        <xs:element minOccurs="0" name="Purpose">
     49          <xs:simpleType>
     50            <xs:restriction base="xs:string">
     51              <xs:enumeration value="research" />
     52              <xs:enumeration value="reference" />
     53              <xs:enumeration value="sample" />
     54              <xs:enumeration value="future-use" />
     55              <!-- to be extended -->
     56            </xs:restriction>
     57          </xs:simpleType>
     58        </xs:element>
     59        <xs:element minOccurs="0" name="Reproducibility">
     60          <xs:simpleType>
     61            <xs:restriction base="xs:string">
     62              <xs:enumeration value="intended" />
     63              <xs:enumeration value="fluctuating" />
     64              <xs:enumeration value="untended" />
     65            </xs:restriction>
     66          </xs:simpleType>
     67        </xs:element>
     68        <xs:element minOccurs="0" name="ReproducibilityNotice"
     69          type="xs:string" />
     70        <xs:element name="Resources">
     71          <xs:complexType>
     72            <xs:sequence maxOccurs="unbounded">
     73              <xs:element name="Resource">
     74                <xs:complexType>
     75                  <xs:sequence>
     76                    <xs:element name="ResourceType">
     77                      <xs:simpleType>
     78                        <xs:restriction base="xs:string">
     79                          <xs:enumeration value="Metadata" />
     80                          <xs:enumeration value="Resource" />
     81                        </xs:restriction>
     82                      </xs:simpleType>
     83                    </xs:element>
     84                    <xs:element name="ResourceRef">
     85                      <xs:simpleType>
     86                        <xs:restriction base="xs:anyURI" />
     87                      </xs:simpleType>
     88                    </xs:element>
     89                  </xs:sequence>
     90                </xs:complexType>
     91              </xs:element>
     92            </xs:sequence>
     93          </xs:complexType>
     94        </xs:element>
     95        <xs:element name="GeneratedBy" minOccurs="0">
     96          <xs:complexType>
     97            <xs:sequence>
     98              <xs:element name="Description" type="xs:string" />
     99              <xs:element name="Query" maxOccurs="1"
     100                minOccurs="0">
     101                <xs:complexType>
     102                  <xs:sequence>
     103                    <xs:any namespace="##any" processContents="lax" />
     104                  </xs:sequence>
     105                  <xs:attribute name="profile" type="xs:string"
     106                    use="optional" />
     107                </xs:complexType>
     108              </xs:element>
     109            </xs:sequence>
     110          </xs:complexType>
     111        </xs:element>
     112      </xs:sequence>
     113      <xs:attribute name="id" type="xs:long" use="optional" />
     114      <xs:attribute name="persistentId" type="xs:string"
     115        use="optional" />
     116      <xs:attribute name="state" use="optional">
     117        <xs:simpleType>
     118          <xs:restriction base="xs:string">
     119            <xs:enumeration value="private" />
     120            <xs:enumeration value="public-pending" />
     121            <xs:enumeration value="public" />
     122            <xs:enumeration value="deleted" />
     123            <xs:enumeration value="dead" />
     124          </xs:restriction>
     125        </xs:simpleType>
     126      </xs:attribute>
     127    </xs:complexType>
     128  </xs:element>
    89129</xs:schema>
Note: See TracChangeset for help on using the changeset viewer.