cirneco 0.9.3 → 0.9.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/lib/cirneco/utils.rb +14 -2
  4. data/lib/cirneco/version.rb +1 -1
  5. data/resources/jats-1.1/JATS-journalpublishing1-elements.xsd +8608 -0
  6. data/resources/jats-1.1/JATS-journalpublishing1-mathml3-elements.xsd +8608 -0
  7. data/resources/jats-1.1/JATS-journalpublishing1-mathml3.xsd +48 -0
  8. data/resources/jats-1.1/JATS-journalpublishing1.xsd +59 -0
  9. data/resources/jats-1.1/module-ali.xsd +46 -0
  10. data/resources/jats-1.1/standard-modules/mathml2/common/common-attribs.xsd +44 -0
  11. data/resources/jats-1.1/standard-modules/mathml2/common/math.xsd +126 -0
  12. data/resources/jats-1.1/standard-modules/mathml2/common/xlink-href.xsd +20 -0
  13. data/resources/jats-1.1/standard-modules/mathml2/content/arith.xsd +90 -0
  14. data/resources/jats-1.1/standard-modules/mathml2/content/calculus.xsd +146 -0
  15. data/resources/jats-1.1/standard-modules/mathml2/content/common-attrib.xsd +30 -0
  16. data/resources/jats-1.1/standard-modules/mathml2/content/constants.xsd +83 -0
  17. data/resources/jats-1.1/standard-modules/mathml2/content/constructs.xsd +260 -0
  18. data/resources/jats-1.1/standard-modules/mathml2/content/elementary-functions.xsd +117 -0
  19. data/resources/jats-1.1/standard-modules/mathml2/content/functions.xsd +73 -0
  20. data/resources/jats-1.1/standard-modules/mathml2/content/linear-algebra.xsd +173 -0
  21. data/resources/jats-1.1/standard-modules/mathml2/content/logic.xsd +53 -0
  22. data/resources/jats-1.1/standard-modules/mathml2/content/relations.xsd +55 -0
  23. data/resources/jats-1.1/standard-modules/mathml2/content/semantics.xsd +85 -0
  24. data/resources/jats-1.1/standard-modules/mathml2/content/sets.xsd +236 -0
  25. data/resources/jats-1.1/standard-modules/mathml2/content/statistics.xsd +136 -0
  26. data/resources/jats-1.1/standard-modules/mathml2/content/tokens.xsd +120 -0
  27. data/resources/jats-1.1/standard-modules/mathml2/content/vector-calculus.xsd +88 -0
  28. data/resources/jats-1.1/standard-modules/mathml2/content/zzz.tokens.xsd.from.zip +120 -0
  29. data/resources/jats-1.1/standard-modules/mathml2/mathml2.xsd +59 -0
  30. data/resources/jats-1.1/standard-modules/mathml2/presentation/action.xsd +44 -0
  31. data/resources/jats-1.1/standard-modules/mathml2/presentation/characters.xsd +37 -0
  32. data/resources/jats-1.1/standard-modules/mathml2/presentation/common-attribs.xsd +113 -0
  33. data/resources/jats-1.1/standard-modules/mathml2/presentation/common-types.xsd +103 -0
  34. data/resources/jats-1.1/standard-modules/mathml2/presentation/error.xsd +40 -0
  35. data/resources/jats-1.1/standard-modules/mathml2/presentation/layout.xsd +195 -0
  36. data/resources/jats-1.1/standard-modules/mathml2/presentation/scripts.xsd +186 -0
  37. data/resources/jats-1.1/standard-modules/mathml2/presentation/space.xsd +52 -0
  38. data/resources/jats-1.1/standard-modules/mathml2/presentation/style.xsd +69 -0
  39. data/resources/jats-1.1/standard-modules/mathml2/presentation/table.xsd +216 -0
  40. data/resources/jats-1.1/standard-modules/mathml2/presentation/tokens.xsd +124 -0
  41. data/resources/jats-1.1/standard-modules/xlink.xsd +100 -0
  42. data/resources/jats-1.1/standard-modules/xml.xsd +287 -0
  43. data/spec/utils_spec.rb +7 -0
  44. metadata +39 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dd3065adc1cb6911df346e860c593b574dabd85b
4
- data.tar.gz: 06411e0894e4d5da3a5ec90bdfa0d2bd6341f0a1
3
+ metadata.gz: dec9f419a130f442d9566c1b1b8f14558cd9cc9c
4
+ data.tar.gz: a3f74b49e2091319e75133d095bbdfcf72617468
5
5
  SHA512:
6
- metadata.gz: b5c3cb04cddf16c67508882eee5a20d2f49b092d38aa5aebddf855c8df6336d1b35533b7cb3cda01b0e1a9ed53b015ecda00cb97f08b611768cee912e2fa838f
7
- data.tar.gz: c89fec1028b04d7c0833be8ba3ae47cfc9b172c4681cf5dfd592c7924c598e2fc5994ce1f9dc97661819b8d7584ddb20484073c7102dcae98c4a39d6288ab3aa
6
+ metadata.gz: 709e81691d11909d0eb8422da8b626598728a8833aa075f207f220863048f4228996b01a972d8453d87bf5a70fd41fcb319336d86612f8ced277511b985e486b
7
+ data.tar.gz: e203227e1b9088c0d31f4c4c7e3bb13f741011e3fae40ace161cc455dcea6ab0633f3acbabdbf7d91cd1c3259647d8f277c4d28ecc9fec47b80f0bec0615c05b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirneco (0.9.3)
4
+ cirneco (0.9.4)
5
5
  activesupport (~> 4.2, >= 4.2.5)
6
6
  base32-crockford-checksum (~> 0.2.2)
7
7
  bergamasco (~> 0.3)
@@ -22,7 +22,7 @@ GEM
22
22
  tzinfo (~> 1.1)
23
23
  addressable (2.3.8)
24
24
  base32-crockford-checksum (0.2.3)
25
- bergamasco (0.3.9)
25
+ bergamasco (0.3.10)
26
26
  activesupport (~> 4.2, >= 4.2.5)
27
27
  addressable (~> 2.3.8)
28
28
  builder (~> 3.2, >= 3.2.2)
data/lib/cirneco/utils.rb CHANGED
@@ -9,6 +9,8 @@ module Cirneco
9
9
  # "ZZZZZZZ" decoded as number
10
10
  UPPER_LIMIT = 34359738367
11
11
 
12
+ JATS_SCHEMA = File.expand_path("../../../resources/jats-1.1/JATS-journalpublishing1.xsd", __FILE__)
13
+
12
14
  LICENSES = {
13
15
  "https://creativecommons.org/licenses/by/4.0/" => "Creative Commons Attribution (CC-BY 4.0)",
14
16
  "https://creativecommons.org/publicdomain/zero/1.0/" => "Creative Commons Public Domain Dedication (CC0 1.0)"
@@ -325,6 +327,9 @@ module Cirneco
325
327
  metadata["publication_month"] = metadata.fetch("date", "")[5..6].to_i
326
328
  metadata["publication_day"] = metadata.fetch("date", "")[8..9].to_i
327
329
 
330
+ # metadata["accession_number"] = metadata["alternateName"]
331
+ metadata["journal_title"] = metadata.fetch("isPartOf", {}).fetch("name", nil)
332
+
328
333
  if metadata["description"].present?
329
334
  metadata["descriptions"] = [{ value: metadata["description"], description_type: "Abstract" }]
330
335
  end
@@ -342,7 +347,7 @@ module Cirneco
342
347
 
343
348
  metadata = metadata.extract!(*%w(publisher doi tags title author date
344
349
  publication_year publication_month publication_day license_name
345
- license_url))
350
+ license_url accession_number journal_title))
346
351
  end
347
352
 
348
353
  def generate_jats_for_url(url, options={})
@@ -373,6 +378,13 @@ module Cirneco
373
378
  end.join("\n")
374
379
  end
375
380
 
381
+ def validate_jats(xml)
382
+ schema = Nokogiri::XML::Schema(open(JATS_SCHEMA))
383
+ puts schema.validate(Nokogiri::XML(xml))
384
+
385
+ OpenStruct.new(body: { "errors" => schema.validate(Nokogiri::XML(xml)).map { |error| { "title" => error.to_s } } })
386
+ end
387
+
376
388
  def url_from_path(site_url, filepath)
377
389
  site_url.to_s.chomp("\\") + "/" + File.basename(filepath)[0..-9] + "/"
378
390
  end
@@ -428,7 +440,7 @@ module Cirneco
428
440
  def filepath_from_url(url, options={})
429
441
  if doi_from_url(url)
430
442
  response = Maremma.head(url, limit: 0)
431
- url = response.headers.fetch("Location", "")
443
+ url = response.headers.present? ? response.headers.fetch("Location", "") : ""
432
444
  end
433
445
 
434
446
  uri = Addressable::URI.parse(url.gsub(Dir.pwd + options[:build_dir].to_s, "")
@@ -1,3 +1,3 @@
1
1
  module Cirneco
2
- VERSION = "0.9.3"
2
+ VERSION = "0.9.4"
3
3
  end