relaton / relaton-iso

RelatonIso: ISO Standards metadata using the BibliographicItem model
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

For `ISO/{doctype}` identifiers that failed to search, also attempt the version with no doctype #147

Closed ronaldtse closed 1 year ago

ronaldtse commented 1 year ago
$ bundle exec relaton fetch "ISO/TS 19103:2015"
[relaton-iso] ("ISO/TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/TS 19103:2015") TIP: No match for edition year 2015, but matches exist for 2005.
[relaton-iso] ("ISO/TS 19103:2015") Not found, trying with ISO/IEC prefix ("ISO/IEC TS 19103:2015")...
[relaton-iso] ("ISO/IEC TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/IEC TS 19103:2015") Not found. 
[relaton-iso] ("ISO/TS 19103:2015") Not found. The identifier must be exactly as shown on the ISO website.
[relaton-iso] ("ISO/TS 19103:2015") TIP: If you wish to cite all document parts for the reference, use ("ISO/TS 19103 (all parts)").
[relaton-iso] ("ISO/TS 19103:2015") TIP: If the document is not an International Standard, use its deliverable type abbreviation (TS, TR, PAS, Guide).
No matching bibliographic entry found

Actually, there are two identifiers that are similar:

I'm actually not sure what should be the default behavior. To best assist the user, I believe we should provide both in an "TIP:" message.

Perhaps the "edition year" is a better indicator than "doctype"?

andrew2net commented 1 year ago

@ronaldtse should we just warn user that there is version without type, or return a document without type?

ronaldtse commented 1 year ago

@andrew2net we should probably just warn user that there is a document does not have type, an return a failure in fetch.

andrew2net commented 1 year ago

@ronaldtse is this correct behaviour?

relaton fetch "ISO/TS 19103:2015"
[relaton-iso] ("ISO/TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/TS 19103:2015") TIP: No match for edition year 2015, but matches exist for 2005.
[relaton-iso] ("ISO/TS 19103:2015") Not found, trying without type ("ISO 19103:2015")...
[relaton-iso] ("ISO 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO 19103:2015") TIP: Found without type, please use reference ("ISO 19103:2015").
No matching bibliographic entry found
ronaldtse commented 1 year ago

@andrew2net can you change it to the following?

$ relaton fetch "ISO/TS 19103:2015"
[relaton-iso] ("ISO/TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/TS 19103:2015") TIP: No exact match. Trying modified identifiers...
[relaton-iso] ("ISO/TS 19103:2015") TIP:  Matches exist for "ISO/TS 19103:2005", "ISO 19103:2015".
No matching bibliographic entry found
andrew2net commented 1 year ago

@ronald it could be many years of document versions. In that case we need to list all the possible years. I think better to have

[relaton-iso] ("ISO/TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/TS 19103:2015") TIP: No match for edition year 2015, but matches exist for 2005.
[relaton-iso] ("ISO/TS 19103:2015") TIP: Matches exist for "ISO/TS 19103:2005"
No matching bibliographic entry found

The relation-iso has also trying for ISO/IEC if ISO not found. In this case ISO/IEC document is returned if found. Should we keep this behavior? Or also return failure?

andrew2net commented 1 year ago

@ronaldtse I refactored the gem's warns. In case document is not found we get messages:

"(\"#{pubid}\") Not found."

# if there is/are document(s) with other years
"(\"#{pubid}\") TIP: No match for edition year #{pubid.year}, but matches exist for #{missed_years.join(', ')}."

# if there are documents without or with other type/stage/copublisher
"(\"#{pubid}\") TIP: Matches exist for #{other_ids}."

# if reference has part
"(\"#{pubid}\") TIP: If it cannot be found, the document may no longer be published in parts."

# if reference has no parts
"(\"#{pubid}\") TIP: If you wish to cite all document parts for the reference, use (\"#{pubid.to_s(format: :ref_undated)} (all parts)\")."

You can try it with a issue-147 branch. If everithing is ok, I'll merge the branc to main and release.

ronaldtse commented 1 year ago
"(\"#{pubid}\") TIP: No match for edition year #{pubid.year}, but matches exist for #{missed_years.join(', ')}."

Can we give the full references of different edition years, so people can just copy and paste? Thanks.

andrew2net commented 1 year ago

Fixed in v1.15.5

$ relaton fetch "ISO/TS 19103:2015"
[relaton-iso] ("ISO/TS 19103:2015") Fetching from ISO...
[relaton-iso] ("ISO/TS 19103:2015") Not found.
[relaton-iso] ("ISO/TS 19103:2015") TIP: No match for edition year 2015, but matches exist for "ISO/TS 19103:2005".
[relaton-iso] ("ISO/TS 19103:2015") TIP: If you wish to cite all document parts for the reference, use ("ISO/TS 19103 (all parts)").
ronaldtse commented 1 year ago

Thanks!

Can we make consistent the reference format for people to copy?

...TIP: No match for edition year 2015, but matches exist for "ISO/TS 19103:2005".
...TIP: If you wish to cite all document parts for the reference, use "ISO/TS 19103 (all parts)".

Thanks.

andrew2net commented 1 year ago

Can we make consistent the reference format for people to copy?

@ronaldtse what do you mean? Aren't "ISO/TS 19103:2005" and "ISO/TS 19103 (all parts)" references? We can place each reference in a separate line so people can select them with triple click and copy.

...TIP: No match for edition year 2015, but matches exist for:
ISO/TS 19103:2005
...TIP: If you wish to cite all document parts for the reference, use:
ISO/TS 19103 (all parts)
ronaldtse commented 1 year ago

@andrew2net yes they are correct, but when we present them we should do it consistently. In the previous implementation, sometimes we use double quotes "..." but sometimes we use parentheses (...) to contain references. As long as we do them consistently, it's okay.

How about using backticks? (`...`)

...TIP: No match for edition year 2015, but matches exist for: `ISO/TS 19103:2005`, [...]
...TIP: If you wish to cite all document parts for the reference, use: `ISO/TS 19103 (all parts)`
andrew2net commented 1 year ago

@ronaldtse Ok, I see. Let's use backticks for references.

andrew2net commented 1 year ago

@ronaldtse What if we use parentheses for user provided reference and backticks for TIPs and found reference?

[relaton-iso] (ISO/TS 19103:2015) TIP: No match for edition year 2015, but matches exist for `ISO/TS 19103:2005`.
[relaton-iso] (ISO 19115) Found `ISO 19115:2003`.

I think it's easier to read than:

[relaton-iso] (`ISO/TS 19103:2015`) TIP: No match for edition year 2015, but matches exist for `ISO/TS 19103:2005`.
[relaton-iso] (`ISO 19115`) Found `ISO 19115:2003`.
ronaldtse commented 1 year ago

@andrew2net fully agree, let's do this.

ronaldtse commented 1 year ago

Maybe it should be:

[relaton-iso] (query: "ISO 19115") Found `ISO 19115:2003`.
andrew2net commented 1 year ago

@ronaldtse in my opinion it's too verbose. The word "query" will be in each line. Displaying the query reference helps when async document searching is used. It shows which reference a message belongs to. I think any extra symbols will pollute logging.

ronaldtse commented 1 year ago

Displaying the query reference helps when async document searching is used. It shows which reference a message belongs to.

Yes, so we need to keep showing the query reference anyway, just like now.

I think any extra symbols will pollute logging.

Maybe but the user may get confused what the first reference is...?

I agree that this works fine, let's do this:

[relaton-iso] (ISO 19115) Found `ISO 19115:2003`.
ronaldtse commented 1 year ago

@andrew2net can I confirm that the messages are now consistent?

The word "query" will be in each line.

We could also use q: ... instead. It's better for the user to know what's going on than not know.

andrew2net commented 1 year ago

@andrew2net can I confirm that the messages are now consistent?

They are consistent in the relaton-iso gem. Other relaton-* gems need to be updated.

We could also use q: ... instead. It's better for the user to know what's going on than not know.

Just (ISO 19115) looks intuitive to me.