Closed ronaldtse closed 5 years ago
@andrew2net this is a critical error, can you help fix ASAP? Thanks!
@ronaldtse how can I reproduce the error?
@andrew2net add this reference to a Metanorma document:
* [[[NISTCSF11,NIST Framework for Improving Critical Infrastructure Cybersecurity Version 1.1]]], _NIST Framework for Improving Critical Infrastructure Cybersecurity Version 1.1_
@ronaldtse seems the XML element /bibitem/date
doesn't contain required on
or from
ement.
bdate = element date {
attribute type { ( BibliographicDateType | text ) },
(
(
element from { ISO8601Date },
element to { ISO8601Date }?
) |
element on { ISO8601Date }
)
}
I don't know where is the XML from and why it doesn't contain the required element. If you want I can remove this validation.
Still failing but on a new error:
bundler: failed to load command: metanorma (/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bin/metanorma)
ArgumentError: invalid argument: stage (20)
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/nistbib/document_status.rb:14:in `initialize'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/nistbib/xml_parser.rb:26:in `new'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/nistbib/xml_parser.rb:26:in `fetch_status'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:32:in `item_data'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/nistbib/xml_parser.rb:13:in `item_data'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/nistbib/xml_parser.rb:7:in `from_xml'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.7/lib/relaton/processor.rb:19:in `from_xml'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:141:in `bib_retval'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:162:in `check_bibliocache'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:42:in `fetch'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/metanorma-standoc-1.1.9/lib/asciidoctor/standoc/ref.rb:104:in `fetch_ref'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/metanorma-standoc-1.1.9/lib/asciidoctor/standoc/ref.rb:128:in `refitem'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/metanorma-standoc-1.1.9/lib/asciidoctor/standoc/ref.rb:181:in `reference1'
Which leads to this document: https://www.nist.gov/publications/framework-improving-critical-infrastructure-cybersecurity-version-11
I have a feeling that you could infer the document type from the DOI link:
https://doi.org/10.6028/NIST.CSWP.04162018
This indicates it is a "CSWP", and since it is not a draft, it is a "final".
@ronaldtse nistbib
uses https://csrc.nist.gov/publications for search. See https://github.com/metanorma/relaton/issues/21
When I search the reference on the csrc.nist.gov I got this document https://csrc.nist.gov/publications/detail/white-paper/2017/12/05/cybersecurity-framework-v11/draft without any error.
The error is caused by invalid stage
, but I see we don't have validations for stage
and substage
anymore. So I'll remove the validations.
@andrew2net now the error is this:
/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bin/metanorma)
ArgumentError: Type "" is invalid.
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/bibliographic_item.rb:182:in `initialize'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:284:in `new'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:284:in `block in fetch_relations'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:204:in `block in each'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:203:in `upto'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:203:in `each'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:273:in `map'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:273:in `fetch_relations'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-bib-0.1.5/lib/relaton_bib/xml_parser.rb:34:in `item_data'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.8/lib/nistbib/xml_parser.rb:13:in `item_data'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.8/lib/nistbib/xml_parser.rb:7:in `from_xml'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nistbib-0.1.8/lib/relaton/processor.rb:19:in `from_xml'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:141:in `bib_retval'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:162:in `check_bibliocache'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/relaton-0.3.4/lib/relaton/db.rb:42:in `fetch'
If I remove that line, the compilation works.
@andrew2net and we should obtain the "final" document, not the draft?
https://csrc.nist.gov/publications/detail/white-paper/2018/04/16/cybersecurity-framework-v11/final
The first two matches are 100% and are both "Final".
And we can disable "draft" in search:
@ronaldtse the empty type cause error. I fixed parsing XML in relaton-bib
. Pull relato-bib
and check again, please.
So if there isn't draft in reference then we should search for final
documents only, do we?
So if there isn't draft in reference then we should search for final documents only, do we?
I think so. Thoughts @opoudjis ?
Failure log of git relaton-bib
:
ArgumentError: Type "" is invalid.
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/relaton-bib-e108a0df4881/lib/relaton_bib/bibliographic_item.rb:183:in `initialize'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/relaton-bib-e108a0df4881/lib/relaton_bib/xml_parser.rb:282:in `new'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/relaton-bib-e108a0df4881/lib/relaton_bib/xml_parser.rb:282:in `block in fetch_relations'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:204:in `block in each'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:203:in `upto'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/nokogiri-1.8.5/lib/nokogiri/xml/node_set.rb:203:in `each'
/Users/me/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/bundler/gems/relaton-bib-e108a0df4881/lib/relaton_bib/xml_parser.rb:271:in `map'
I cleared relaton cache and it's now working.
However:
So if there isn't draft in reference then we should search for final documents only, do we? I think so. Thoughts @opoudjis ?
I don't have enough context, but yes, one should assume by default that the request is for a published document and not for a draft document, unless a draft is explicitly requested.
Funny thing is I don't think we have a syntax for "find draft"... Do we @opoudjis ?
I assumed the draft was going to be part of the document ID that is fed into the gem; so you'd pass it the argument "NIST 800-53 (IPD)". And that that's what the draft in the website would actually be listed under. The drafts are a restricted vocabulary, since only public drafts are on the website: IPD, 2PD, 3PD, ... FPD.
Passing the draft as a separate parameter is, I suggest, asking for trouble.
I agree with this. Do we have documentation for this? Can we add this? I feel that this belongs in Relaton?
I'm not aware of documentation; I've stayed at arm's length from relaton-nist. It certainly would need to be a feature of how relaton-nist works, and documented there.
I was just hoping that the documents were already labelled as "NIST 800-53 (IPD)". How are drafts identified currently?
@ronaldtse
The document type is rendering in lowercase "nist" instead of "NIST"
Do you mean docidentifier?
<docidentifier type="nist">SP 800-189 (DRAFT)</docidentifier>
Will fix it. What types are possible?
@ronaldtse
And we can disable "draft" in search:
There is a problem with these searches options:
Final
without enabling Withdrawn
then it doesn't search for final-withdrawn documents.Final
and Withdrawn
options then it searches for final, final-withdrawn, and draft-withdrawn.Do we need to get in search results final and final-withdrawn documents when we search for finals? If so then we need workaround it somehow.
We need Final and Withdrawn, but prioritize Final over Withdrawn. In the search interface it is possible to search for these two types together.
Then the issue is, the option Withdrawn
doesn't distinguish between final-withdrawn and draft-withdrawn documents. So we need to get a result from the site and filter documents in our gem.
Yes, we will need to filter documents with our own gem. Their search isn't perfect.
@ronaldtse
The document type is rendering in lowercase "nist" instead of "NIST"
Do you mean docidentifier?
<docidentifier type="nist">SP 800-189 (DRAFT)</docidentifier>
Will fix it. What types are possible?
I've fixed the lowercasing today.