From ff7c7c578fe4c11e18bc1da569d6eda5c5d6f40c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ketil=20Aasar=C3=B8d?= <55836988+ketilaa@users.noreply.github.com> Date: Thu, 9 Jan 2025 14:46:22 +0100 Subject: [PATCH] added module for generating jaxb-annotated classes (#627) * added module for generating jaxb-annotated classes based on xsd schema files * skip check task all together for code generating module --- oai-pmh/build.gradle | 12 + oai-pmh/src/main/resources/OAI-PMH-2_0.xsd | 317 ++++++++++++++ oai-pmh/src/main/resources/XMLSchema.dtd | 402 ++++++++++++++++++ oai-pmh/src/main/resources/datatypes.dtd | 203 +++++++++ oai-pmh/src/main/resources/oai_dc.xsd | 43 ++ .../src/main/resources/simpledc20021212.xsd | 78 ++++ oai-pmh/src/main/resources/xml.xsd | 117 +++++ settings.gradle | 1 + 8 files changed, 1173 insertions(+) create mode 100644 oai-pmh/build.gradle create mode 100644 oai-pmh/src/main/resources/OAI-PMH-2_0.xsd create mode 100644 oai-pmh/src/main/resources/XMLSchema.dtd create mode 100644 oai-pmh/src/main/resources/datatypes.dtd create mode 100644 oai-pmh/src/main/resources/oai_dc.xsd create mode 100644 oai-pmh/src/main/resources/simpledc20021212.xsd create mode 100644 oai-pmh/src/main/resources/xml.xsd diff --git a/oai-pmh/build.gradle b/oai-pmh/build.gradle new file mode 100644 index 000000000..23efc27f6 --- /dev/null +++ b/oai-pmh/build.gradle @@ -0,0 +1,12 @@ +plugins { + id("com.github.bjornvester.xjc") version "1.8.2" +} + +xjc { + defaultPackage.set('org.openarchives.oai.v2.generated') +} + +// effectively skip all tests and verifications for this module +tasks.named("check").configure { + dependsOn = [] +} diff --git a/oai-pmh/src/main/resources/OAI-PMH-2_0.xsd b/oai-pmh/src/main/resources/OAI-PMH-2_0.xsd new file mode 100644 index 000000000..e8bd9d78e --- /dev/null +++ b/oai-pmh/src/main/resources/OAI-PMH-2_0.xsd @@ -0,0 +1,317 @@ + + + + + XML Schema which can be used to validate replies to all OAI-PMH + v2.0 requests. Herbert Van de Sompel, 2002-05-13. + Validated with XML Spy v.4.3 on 2002-05-13. + Validated with XSV 1.203.2.45/1.106.2.22 on 2002-05-13. + Added definition of protocolVersionType instead of using anonymous + type. No change of function. Simeon Warner, 2004-03-29. + Tightened definition of UTCdatetimeType to enforce the restriction + to UTC Z notation. Simeon Warner, 2004-09-14. + Corrected pattern matches for setSpecType and metadataPrefixType + to agree with protocol specification. Simeon Warner, 2004-10-12. + Spelling correction. Simeon Warner, 2008-12-07. + $Date: 2004/10/12 15:20:29 $ + + + + + + + + + + + + + + + + + + + + + + + + Define requestType, indicating the protocol request that + led to the response. Element content is BASE-URL, attributes are arguments + of protocol request, attribute-values are values of arguments of protocol + request + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + A record has a header, a metadata part, and + an optional about container + + + + + + + + + + + A header has a unique identifier, a datestamp, + and setSpec(s) in case the item from which + the record is disseminated belongs to set(s). + the header can carry a deleted status indicating + that the record is deleted. + + + + + + + + + + + + + + + + + + + + + + Metadata must be expressed in XML that complies + with another XML Schema (namespace=#other). Metadata must be + explicitly qualified in the response. + + + + + + + + + Data "about" the record must be expressed in XML + that is compliant with an XML Schema defined by a community. + + + + + + + + + A resumptionToken may have 3 optional attributes + and can be used in ListSets, ListIdentifiers, ListRecords + responses. + + + + + + + + + + + + + The descriptionType is used for the description + element in Identify and for setDescription element in ListSets. + Content must be compliant with an XML Schema defined by a + community. + + + + + + + + + Datestamps are to either day (type date) + or to seconds granularity (type oai:UTCdateTimeZType) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oai-pmh/src/main/resources/XMLSchema.dtd b/oai-pmh/src/main/resources/XMLSchema.dtd new file mode 100644 index 000000000..e49500043 --- /dev/null +++ b/oai-pmh/src/main/resources/XMLSchema.dtd @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %xs-datatypes; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oai-pmh/src/main/resources/datatypes.dtd b/oai-pmh/src/main/resources/datatypes.dtd new file mode 100644 index 000000000..f4b454c16 --- /dev/null +++ b/oai-pmh/src/main/resources/datatypes.dtd @@ -0,0 +1,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oai-pmh/src/main/resources/oai_dc.xsd b/oai-pmh/src/main/resources/oai_dc.xsd new file mode 100644 index 000000000..381619968 --- /dev/null +++ b/oai-pmh/src/main/resources/oai_dc.xsd @@ -0,0 +1,43 @@ + + + + + + + XML Schema 2002-03-18 by Pete Johnston. + Adjusted for usage in the OAI-PMH. + Schema imports the Dublin Core elements from the DCMI schema for unqualified Dublin Core. + 2002-12-19 updated to use simpledc20021212.xsd (instead of simpledc20020312.xsd) + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/oai-pmh/src/main/resources/simpledc20021212.xsd b/oai-pmh/src/main/resources/simpledc20021212.xsd new file mode 100644 index 000000000..46467efcb --- /dev/null +++ b/oai-pmh/src/main/resources/simpledc20021212.xsd @@ -0,0 +1,78 @@ + + + + + + + Simple DC XML Schema, 2002-10-09 + by Pete Johnston (p.johnston@ukoln.ac.uk), + Carl Lagoze (lagoze@cs.cornell.edu), Andy Powell (a.powell@ukoln.ac.uk), + Herbert Van de Sompel (hvdsomp@yahoo.com). + This schema defines terms for Simple Dublin Core, i.e. the 15 + elements from the http://purl.org/dc/elements/1.1/ namespace, with + no use of encoding schemes or element refinements. + Default content type for all elements is xs:string with xml:lang + attribute available. + + Supercedes version of 2002-03-12. + Amended to remove namespace declaration for http://www.w3.org/XML/1998/namespace namespace, + and to reference lang attribute via built-in xml: namespace prefix. + xs:appinfo also removed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/oai-pmh/src/main/resources/xml.xsd b/oai-pmh/src/main/resources/xml.xsd new file mode 100644 index 000000000..b9c0401fb --- /dev/null +++ b/oai-pmh/src/main/resources/xml.xsd @@ -0,0 +1,117 @@ + + + + + + + See http://www.w3.org/XML/1998/namespace.html and + http://www.w3.org/TR/REC-xml for information about this namespace. + + This schema document describes the XML namespace, in a form + suitable for import by other schema documents. + + Note that local names in this namespace are intended to be defined + only by the World Wide Web Consortium or its subgroups. The + following names are currently defined in this namespace and should + not be used with conflicting semantics by any Working Group, + specification, or document instance: + + base (as an attribute name): denotes an attribute whose value + provides a URI to be used as the base for interpreting any + relative URIs in the scope of the element on which it + appears; its value is inherited. This name is reserved + by virtue of its definition in the XML Base specification. + + lang (as an attribute name): denotes an attribute whose value + is a language code for the natural language of the content of + any element; its value is inherited. This name is reserved + by virtue of its definition in the XML specification. + + space (as an attribute name): denotes an attribute whose + value is a keyword indicating what whitespace processing + discipline is intended for the content of the element; its + value is inherited. This name is reserved by virtue of its + definition in the XML specification. + + Father (in any context at all): denotes Jon Bosak, the chair of + the original XML Working Group. This name is reserved by + the following decision of the W3C XML Plenary and + XML Coordination groups: + + In appreciation for his vision, leadership and dedication + the W3C XML Plenary on this 10th day of February, 2000 + reserves for Jon Bosak in perpetuity the XML name + xml:Father + + + + + This schema defines attributes and an attribute group + suitable for use by + schemas wishing to allow xml:base, xml:lang or xml:space attributes + on elements they define. + + To enable this, such a schema must import this schema + for the XML namespace, e.g. as follows: + <schema . . .> + . . . + <import namespace="http://www.w3.org/XML/1998/namespace" + schemaLocation="http://www.w3.org/2001/03/xml.xsd"/> + + Subsequently, qualified reference to any of the attributes + or the group defined below will have the desired effect, e.g. + + <type . . .> + . . . + <attributeGroup ref="xml:specialAttrs"/> + + will define a type which will schema-validate an instance + element with any of those attributes + + + + In keeping with the XML Schema WG's standard versioning + policy, this schema document will persist at + http://www.w3.org/2001/03/xml.xsd. + At the date of issue it can also be found at + http://www.w3.org/2001/xml.xsd. + The schema document at that URI may however change in the future, + in order to remain compatible with the latest version of XML Schema + itself. In other words, if the XML Schema namespace changes, the version + of this document at + http://www.w3.org/2001/xml.xsd will change + accordingly; the version at + http://www.w3.org/2001/03/xml.xsd will not change. + + + + + + In due course, we should install the relevant ISO 2- and 3-letter + codes as the enumerated possible values . . . + + + + + + + + + + + + + + + See http://www.w3.org/TR/xmlbase/ for + information about this attribute. + + + + + + + + + + \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 91b82254e..5017c5032 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,3 +4,4 @@ include 'search-testing' include 'search-handlers' include 'indexing-handlers' include 'batch-index' +include 'oai-pmh'