bolognese 1.2.15 → 1.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/bolognese/utils.rb +1 -0
- data/lib/bolognese/version.rb +1 -1
- data/spec/fixtures/schema_org_type_as_array.json +41 -0
- data/spec/readers/schema_org_reader_spec.rb +18 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84b31aa209d784909a59c928b9dded98a3be2131fb3b44584d0a5d614cceb1d1
|
4
|
+
data.tar.gz: dea1bd892f19caf85b51f3cdc48347b4c442c1f3234717ba762e2b486fd12020
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 269272d04ba090da97d19d28bb0d1893786189093e2b3ff9a30571201626b4a8da3f788daba6e8de06e9422b08ffe6dfc0fa112bd12ed2374f1b39e2eaae9c7e
|
7
|
+
data.tar.gz: b0ab1ef360037acf936a7665a8bb35f1e09e76ecfec3238e523e8ae23b4d4f74d91599d01695dffcf8e3e631f91c9afb69ba21ddf5b14bcdd8d258bc141d191e
|
data/Gemfile.lock
CHANGED
data/lib/bolognese/utils.rb
CHANGED
@@ -677,6 +677,7 @@ module Bolognese
|
|
677
677
|
def from_schema_org_creators(element)
|
678
678
|
element = Array.wrap(element).map do |c|
|
679
679
|
c["nameIdentifier"] = [{ "__content__" => c["@id"], "nameIdentifierScheme" => "ORCID", "schemeUri" => "https://orcid.org" }] if normalize_orcid(c["@id"])
|
680
|
+
c["@type"] = c["@type"].find { |t| %w(Person Organization).include?(t) } if c["@type"].is_a?(Array)
|
680
681
|
c["creatorName"] = { "nameType" => c["@type"].present? ? c["@type"].titleize + "al" : nil, "__content__" => c["name"] }.compact
|
681
682
|
c.except("@id", "@type", "name")
|
682
683
|
end
|
data/lib/bolognese/version.rb
CHANGED
@@ -0,0 +1,41 @@
|
|
1
|
+
{
|
2
|
+
"@context": "http://schema.org",
|
3
|
+
"@type": "BlogPosting",
|
4
|
+
"@id": "https://doi.org/10.5438/4k3m-nyvg",
|
5
|
+
"name": "Eating your own Dog Food",
|
6
|
+
"url": "https://blog.datacite.org/eating-your-own-dog-food/",
|
7
|
+
"author": [{
|
8
|
+
"@type": ["Person"],
|
9
|
+
"@id": "https://orcid.org/0000-0003-1419-2405",
|
10
|
+
"givenName": "Martin",
|
11
|
+
"familyName": "Fenner",
|
12
|
+
"name": "Martin Fenner",
|
13
|
+
"affiliation": "DataCite"
|
14
|
+
}],
|
15
|
+
"publisher": {
|
16
|
+
"@type": "Organization",
|
17
|
+
"name": "DataCite"
|
18
|
+
},
|
19
|
+
"dateCreated": "2016-12-20",
|
20
|
+
"datePublished": "2016-12-20",
|
21
|
+
"dateModified": "2016-12-20",
|
22
|
+
"keywords": "datacite, doi, metadata, featured",
|
23
|
+
"version": "1.0",
|
24
|
+
"description": "Eating your own dog food is a slang term to describe that an organization should itself use the products and services it provides. For DataCite this means that we should use DOIs with appropriate metadata and strategies for long-term preservation for...",
|
25
|
+
"license": "https://creativecommons.org/licenses/by/4.0/",
|
26
|
+
"image": "/images/2016/12/230785.jpg",
|
27
|
+
"isPartOf": {
|
28
|
+
"@type": "Blog",
|
29
|
+
"@id": "https://doi.org/10.5438/0000-00SS",
|
30
|
+
"name": "DataCite Blog"
|
31
|
+
},
|
32
|
+
"citation": [{
|
33
|
+
"@type": "CreativeWork",
|
34
|
+
"@id": "https://doi.org/10.5438/0012"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"@type": "CreativeWork",
|
38
|
+
"@id": "https://doi.org/10.5438/55E5-T5C0"
|
39
|
+
}
|
40
|
+
]
|
41
|
+
}
|
@@ -42,6 +42,24 @@ describe Bolognese::Metadata, vcr: true do
|
|
42
42
|
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
43
43
|
end
|
44
44
|
|
45
|
+
it "BlogPosting with type as array" do
|
46
|
+
input = fixture_path + 'schema_org_type_as_array.json'
|
47
|
+
subject = Bolognese::Metadata.new(input: input)
|
48
|
+
#expect(subject.valid?).to be true
|
49
|
+
expect(subject.identifiers).to eq([{"identifier"=>"https://doi.org/10.5438/4k3m-nyvg", "identifierType"=>"DOI"}])
|
50
|
+
expect(subject.url).to eq("https://blog.datacite.org/eating-your-own-dog-food")
|
51
|
+
expect(subject.types).to eq("bibtex"=>"article", "citeproc"=>"post-weblog", "resourceTypeGeneral"=>"Text", "ris"=>"GEN", "schemaOrg"=>"BlogPosting")
|
52
|
+
expect(subject.creators).to eq([{"affiliation"=>"DataCite","familyName"=>"Fenner", "givenName"=>"Martin", "name"=>"Fenner, Martin", "nameIdentifiers"=> [{"nameIdentifier"=>"https://orcid.org/0000-0003-1419-2405", "nameIdentifierScheme"=>"ORCID", "schemeUri"=>"https://orcid.org"}], "nameType"=>"Personal"}])
|
53
|
+
expect(subject.titles).to eq([{"title"=>"Eating your own Dog Food"}])
|
54
|
+
expect(subject.descriptions.first["description"]).to start_with("Eating your own dog food")
|
55
|
+
expect(subject.subjects).to eq([{"subject"=>"datacite"}, {"subject"=>"doi"}, {"subject"=>"metadata"}, {"subject"=>"featured"}])
|
56
|
+
expect(subject.dates).to eq([{"date"=>"2016-12-20", "dateType"=>"Issued"}, {"date"=>"2016-12-20", "dateType"=>"Created"}, {"date"=>"2016-12-20", "dateType"=>"Updated"}])
|
57
|
+
expect(subject.publication_year).to eq("2016")
|
58
|
+
expect(subject.related_identifiers.length).to eq(3)
|
59
|
+
expect(subject.related_identifiers.last).to eq("relatedIdentifier"=>"10.5438/55e5-t5c0", "relatedIdentifierType"=>"DOI", "relationType"=>"References")
|
60
|
+
expect(subject.publisher).to eq("DataCite")
|
61
|
+
end
|
62
|
+
|
45
63
|
it "zenodo" do
|
46
64
|
input = "https://www.zenodo.org/record/1196821"
|
47
65
|
subject = Bolognese::Metadata.new(input: input, from: "schema_org")
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolognese
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
@@ -739,6 +739,7 @@ files:
|
|
739
739
|
- spec/fixtures/schema_org_list.json
|
740
740
|
- spec/fixtures/schema_org_tdl_iodp_invalid_authors.json
|
741
741
|
- spec/fixtures/schema_org_topmed.json
|
742
|
+
- spec/fixtures/schema_org_type_as_array.json
|
742
743
|
- spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/default.yml
|
743
744
|
- spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_bibtex.yml
|
744
745
|
- spec/fixtures/vcr_cassettes/Bolognese_CLI/convert_from_id/crossref/to_citation.yml
|