Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/meta/kernel-4.7/metadata.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
2021-03-08 v4.4: Addition of new property relatedItem, relationType value "isPublishedIn", subject subproperty "classificationCode", controlled list "numberType", additional 13 properties for controlled list "resourceType"
2024-01-22 v4.5: Addition of new subproperties for publisher: "publisherIdentifier", "publisherIdentifierScheme", and "schemeURI"; addition of new resourceTypeGeneral values "Instrument" and "StudyRegistration"; addition of new relationType values "Collects" and "IsCollectedBy".
2024-12-05 v4.6: Addition of new resourceTypeGeneral values "Award" and "Project"; addiition of new relatedIdentifierType values "CSTR" and "RRID"; addition of new contributorType "Translator"; addition of new relationTypes "HasTranslation" and "IsTranslationOf"; addition of new dateType "Coverage".
2025-12-31 v4.7: Addition of new resourceTypeGeneral values "Poster" and "Presenation"; addition of new relationType value "Other"; addition of new sub-property "relationTypeInformation" for RelatedIdentifier and RelatedItem.-->
2025-12-31 v4.7: Addition of new resourceTypeGeneral values "Poster" and "Presentation"; addition of new relationType value "Other"; addition of new sub-property "relationTypeInformation" for RelatedIdentifier and RelatedItem.-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified" xml:lang="EN">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="include/xml.xsd" />
<xs:include schemaLocation="include/datacite-titleType-v4.xsd" />
Expand Down
2 changes: 1 addition & 1 deletion source/meta/kernel-4/metadata.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
2021-03-08 v4.4: Addition of new property relatedItem, relationType value "isPublishedIn", subject subproperty "classificationCode", controlled list "numberType", additional 13 properties for controlled list "resourceType"
2024-01-22 v4.5: Addition of new subproperties for publisher: "publisherIdentifier", "publisherIdentifierScheme", and "schemeURI"; addition of new resourceTypeGeneral values "Instrument" and "StudyRegistration"; addition of new relationType values "Collects" and "IsCollectedBy".
2024-12-05 v4.6: Addition of new resourceTypeGeneral values "Award" and "Project"; addiition of new relatedIdentifierType values "CSTR" and "RRID"; addition of new contributorType "Translator"; addition of new relationTypes "HasTranslation" and "IsTranslationOf"; addition of new dateType "Coverage".
2025-12-31 v4.7: Addition of new resourceTypeGeneral values "Poster" and "Presenation"; addition of new relationType value "Other"; addition of new sub-property "relationTypeInformation" for RelatedIdentifier and RelatedItem.-->
2025-12-31 v4.7: Addition of new resourceTypeGeneral values "Poster" and "Presentation"; addition of new relationType value "Other"; addition of new sub-property "relationTypeInformation" for RelatedIdentifier and RelatedItem.-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://datacite.org/schema/kernel-4" targetNamespace="http://datacite.org/schema/kernel-4" elementFormDefault="qualified" xml:lang="EN">
<xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="include/xml.xsd" />
<xs:include schemaLocation="include/datacite-titleType-v4.xsd" />
Expand Down
19 changes: 19 additions & 0 deletions spec/kernel-4.7/doi_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'spec_helper'

describe "validate DOI" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-full-v4.xml")) { |c| c.strict }}}

it '10.5555/123' do
doc.at("identifier").content = "10.5555/123"
errors = xsd.validate(Nokogiri::XML(doc.to_xml)).map { |error| error.to_s }
expect(errors).to be_empty
end

it '10.5555/a' do
doc.at("identifier").content = "10.5555/a"
errors = xsd.validate(Nokogiri::XML(doc.to_xml)).map { |error| error.to_s }
expect(errors).to be_empty
end
end
39 changes: 39 additions & 0 deletions spec/kernel-4.7/example-ancientdates_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
require 'spec_helper'

describe "ancientdates example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-ancientdates-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has resourceTypeGeneral Dataset' do
resource_type = doc.at("resourceType")
expect(resource_type["resourceTypeGeneral"]).to eq("PhysicalObject")
expect(resource_type.text).to eq("Coin")
end

it 'has dates' do
dates = doc.search("dates")
expect(dates.size).to eq(1)
date = dates.first
expect(date.text.strip).to eq("-0024/-0022")
end

it 'has givenName, familyName, and affiliations' do
creators = doc.search("creator")
expect(creators.size).to eq(1)
creator = creators.first
expect(creator.elements.size).to eq(2)

creator_name = creator.elements[0]
expect(creator_name.name).to eq("creatorName")
expect(creator_name.text).to eq("Augustus")

given_name = creator.elements[1]
expect(given_name.name).to eq("nameIdentifier")
expect(given_name.text).to eq("0000000121227317")
end
end
48 changes: 48 additions & 0 deletions spec/kernel-4.7/example_affiliation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-affiliation-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has resourceTypeGeneral Software' do
resource_type = doc.at("resourceType")
expect(resource_type["resourceTypeGeneral"]).to eq("Software")
expect(resource_type.text).to eq("XML")
end

it 'has givenName, familyName, nameIdentifier and affiliations' do
creators = doc.search("creator")
expect(creators.size).to eq(3)
creator = creators.first
expect(creator.elements.size).to eq(5)

creator_name = creator.elements[0]
expect(creator_name.name).to eq("creatorName")
expect(creator_name.text).to eq("Miller, Elizabeth")

given_name = creator.elements[1]
expect(given_name.name).to eq("givenName")
expect(given_name.text).to eq("Elizabeth")

family_name = creator.elements[2]
expect(family_name.name).to eq("familyName")
expect(family_name.text).to eq("Miller")

name_identifier = creator.elements[3]
expect(name_identifier.name).to eq("nameIdentifier")
expect(name_identifier["schemeURI"]).to eq("https://orcid.org/")
expect(name_identifier["nameIdentifierScheme"]).to eq("ORCID")
expect(name_identifier.text).to eq("0000-0001-5000-0007")

affiliation = creator.elements[4]
expect(affiliation.name).to eq("affiliation")
expect(affiliation.text).to eq("DataCite")
expect(affiliation["affiliationIdentifier"]).to eq("https://ror.org/04wxnsj81")
expect(affiliation["affiliationIdentifierScheme"]).to eq("ROR")
end
end
49 changes: 49 additions & 0 deletions spec/kernel-4.7/example_box_date_collected_data_collector_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-Box_dateCollected_DataCollector-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has dateType Collected' do
dates = doc.search("date")
expect(dates.size).to eq(1)
date = dates.first
expect(date["dateType"]).to eq("Collected")
expect(date.text).to eq("1961-06-01/1962-10-12")
end

it 'has contributor DataCollector' do
contributors = doc.search("contributor")
expect(contributors.size).to eq(1)
contributor = contributors.first
expect(contributor["contributorType"]).to eq("DataCollector")
contributor_name = contributor.first_element_child
expect(contributor_name.name).to eq("contributorName")
expect(contributor_name.text).to eq("Pomegranate, B.")
end

it 'has geoLocationBox' do
geo_locations = doc.search("geoLocation")
expect(geo_locations.size).to eq(1)
geo_location = geo_locations.first
expect(geo_location.elements.size).to eq(2)
geo_location_place = geo_location.first_element_child
expect(geo_location_place.name).to eq("geoLocationPlace")
expect(geo_location_place.text).to eq("Ponhook Lake, Nova Scotia")
geo_location_box = geo_location.last_element_child
expect(geo_location_box.name).to eq("geoLocationBox")
expect(geo_location_box.elements[0].name).to eq("westBoundLongitude")
expect(geo_location_box.elements[0].text).to eq("-64.2")
expect(geo_location_box.elements[1].name).to eq("eastBoundLongitude")
expect(geo_location_box.elements[1].text).to eq("-63.8")
expect(geo_location_box.elements[2].name).to eq("southBoundLatitude")
expect(geo_location_box.elements[2].text).to eq("44.7167")
expect(geo_location_box.elements[3].name).to eq("northBoundLatitude")
expect(geo_location_box.elements[3].text).to eq("44.9667")
end
end
11 changes: 11 additions & 0 deletions spec/kernel-4.7/example_complicated_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-complicated-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end
end
17 changes: 17 additions & 0 deletions spec/kernel-4.7/example_dataset_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-dataset-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has resourceTypeGeneral Dataset' do
resource_type = doc.at("resourceType")
expect(resource_type["resourceTypeGeneral"]).to eq("Dataset")
expect(resource_type.text).to eq("Environmental data")
end
end
17 changes: 17 additions & 0 deletions spec/kernel-4.7/example_dissertation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-dissertation-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has resourceTypeGeneral Dissertation' do
resource_type = doc.at("resourceType")
expect(resource_type["resourceTypeGeneral"]).to eq("Dissertation")
expect(resource_type.text).to eq("")
end
end
36 changes: 36 additions & 0 deletions spec/kernel-4.7/example_full_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-full-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has givenName and familyName' do
creators = doc.search("/xmlns:resource/xmlns:creators/xmlns:creator")
expect(creators.size).to eq(2)
creator = creators.first
expect(creator.elements.size).to eq(5)

creator_name = creator.elements[0]
expect(creator_name.name).to eq("creatorName")
expect(creator_name.text).to eq("ExampleFamilyName, ExampleGivenName")

given_name = creator.elements[1]
expect(given_name.name).to eq("givenName")
expect(given_name.text).to eq("ExampleGivenName")

family_name = creator.elements[2]
expect(family_name.name).to eq("familyName")
expect(family_name.text).to eq("ExampleFamilyName")

name_identifier = creator.elements[3]
expect(name_identifier.name).to eq("nameIdentifier")
expect(name_identifier["schemeURI"]).to eq("https://orcid.org")
expect(name_identifier["nameIdentifierScheme"]).to eq("ORCID")
expect(name_identifier.text).to eq("https://orcid.org/0000-0001-5727-2427")
end
end
17 changes: 17 additions & 0 deletions spec/kernel-4.7/example_funding_reference_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-fundingReference-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

# it 'has funderReference' do
# doc.at("funderReferences").first = "<funderReference></f"
# # expect(resource_type["resourceTypeGeneral"]).to eq("Workflow")
# # expect(resource_type.text).to eq("Software")
# end
end
27 changes: 27 additions & 0 deletions spec/kernel-4.7/example_geolocation_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-GeoLocation-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has geoLocation' do
geo_locations = doc.search("geoLocation")
expect(geo_locations.size).to eq(1)
geo_location = geo_locations.first
expect(geo_location.elements.size).to eq(2)
geo_location_place = geo_location.first_element_child
expect(geo_location_place.name).to eq("geoLocationPlace")
expect(geo_location_place.text).to eq("Disko Bay")
geo_location_point = geo_location.last_element_child
expect(geo_location_point.name).to eq("geoLocationPoint")
expect(geo_location_point.elements[0].name).to eq("pointLongitude")
expect(geo_location_point.elements[0].text).to eq("-52.000000")
expect(geo_location_point.elements[1].name).to eq("pointLatitude")
expect(geo_location_point.elements[1].text).to eq("69.000000")
end
end
22 changes: 22 additions & 0 deletions spec/kernel-4.7/example_has_metadata_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
require 'spec_helper'

describe "full example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-HasMetadata-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has relationType HasMetadata' do
related_identifiers = doc.search("relatedIdentifier")
expect(related_identifiers.size).to eq(1)
related_identifier = related_identifiers.first
expect(related_identifier["relationType"]).to eq("HasMetadata")
expect(related_identifier["relatedIdentifierType"]).to eq("URL")
expect(related_identifier["relatedMetadataScheme"]).to eq("ISA-Tab")
expect(related_identifier["schemeURI"]).to eq("http://isatab.sourceforge.net/docs/ISA-TAB_release-candidate-1_v1.0_24nov08.pdf")
expect(related_identifier.text).to eq("http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE18695")
end
end
11 changes: 11 additions & 0 deletions spec/kernel-4.7/example_instrument_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe "instrument example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-instrument-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end
end
11 changes: 11 additions & 0 deletions spec/kernel-4.7/example_multilingual_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'spec_helper'

describe "multilingual example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-multilingual-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end
end
23 changes: 23 additions & 0 deletions spec/kernel-4.7/example_poster_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
require 'spec_helper'

describe "poster example" do
let(:root) { File.join(File.dirname(__FILE__), '../../source/meta/kernel-4') }
let(:xsd) { Dir.chdir(root) { Nokogiri::XML::Schema(File.read("metadata.xsd")) }}
let(:doc) { Dir.chdir(root) { Nokogiri::XML(File.read("example/datacite-example-poster-v4.xml")) { |c| c.strict }}}

it 'validates' do
expect(doc).to pass_validation(xsd)
end

it 'has resourceTypeGeneral Poster' do
resource_type = doc.at("resourceType")
expect(resource_type["resourceTypeGeneral"]).to eq("Poster")
expect(resource_type.text).to eq("Conference poster")
end

it 'has relatedIdentifier with relationType Other and relationTypeInformation' do
related_identifier = doc.search("relatedIdentifiers/relatedIdentifier").first
expect(related_identifier['relationType']).to eq('Other')
expect(related_identifier['relationTypeInformation']).to eq('is output of')
end
end
Loading