BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

mapping loading with mapping type specified or different method name #344

Closed ssssarah closed 10 months ago

ssssarah commented 10 months ago

Adresses https://github.com/BlueBrain/nexus-forge/issues/332

I guess the real issue is that a mapping may be a url, txt or a file path, and if it was neither a url (= couldn't request it) or a filepath (= couldn't load the file), then it was assumed to be a txt mapping. But it could have been intended to be a url but malformed, or a filepath but malformed. Maybe some validation that whatever string is passed is meant to be a text mapping should be done. I've put a hack of a check that it should start with a {, but I'm not even sure this is true of all text mappings.

Update: in checking the validity of the mapping str provided, it brought out that many current mappings in tests are not valid paths, and the failure to load them was silent and did not make the tests fail

codecov-commenter commented 10 months ago

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (ee54140) 73.45% compared to head (7d677cc) 73.87%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #344 +/- ## ========================================== + Coverage 73.45% 73.87% +0.41% ========================================== Files 91 92 +1 Lines 5831 5913 +82 ========================================== + Hits 4283 4368 +85 + Misses 1548 1545 -3 ``` | [Flag](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain) | `73.87% <91.42%> (+0.41%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#carryforward-flags-in-the-pull-request-comment) to find out more. | [Files](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain) | Coverage Δ | | |---|---|---| | [tests/conftest.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dGVzdHMvY29uZnRlc3QucHk=) | `98.98% <100.00%> (ø)` | | | [tests/specializations/mappings/test\_mappings.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dGVzdHMvc3BlY2lhbGl6YXRpb25zL21hcHBpbmdzL3Rlc3RfbWFwcGluZ3MucHk=) | `100.00% <100.00%> (ø)` | | | [tests/specializations/models/test\_demo\_model.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dGVzdHMvc3BlY2lhbGl6YXRpb25zL21vZGVscy90ZXN0X2RlbW9fbW9kZWwucHk=) | `100.00% <100.00%> (ø)` | | | [tests/specializations/models/test\_rdf\_model.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dGVzdHMvc3BlY2lhbGl6YXRpb25zL21vZGVscy90ZXN0X3JkZl9tb2RlbC5weQ==) | `100.00% <100.00%> (ø)` | | | [...sts/specializations/stores/test\_bluebrain\_nexus.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dGVzdHMvc3BlY2lhbGl6YXRpb25zL3N0b3Jlcy90ZXN0X2JsdWVicmFpbl9uZXh1cy5weQ==) | `93.90% <100.00%> (+0.03%)` | :arrow_up: | | [utils.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-dXRpbHMucHk=) | `33.33% <100.00%> (+33.33%)` | :arrow_up: | | [kgforge/specializations/mappings/dictionaries.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-a2dmb3JnZS9zcGVjaWFsaXphdGlvbnMvbWFwcGluZ3MvZGljdGlvbmFyaWVzLnB5) | `90.00% <85.71%> (-2.31%)` | :arrow_down: | | [kgforge/core/archetypes/store.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-a2dmb3JnZS9jb3JlL2FyY2hldHlwZXMvc3RvcmUucHk=) | `59.36% <75.00%> (+0.37%)` | :arrow_up: | | [kgforge/specializations/stores/demo\_store.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-a2dmb3JnZS9zcGVjaWFsaXphdGlvbnMvc3RvcmVzL2RlbW9fc3RvcmUucHk=) | `39.41% <75.00%> (+0.99%)` | :arrow_up: | | [kgforge/core/archetypes/mapping.py](https://app.codecov.io/gh/BlueBrain/nexus-forge/pull/344?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=BlueBrain#diff-a2dmb3JnZS9jb3JlL2FyY2hldHlwZXMvbWFwcGluZy5weQ==) | `81.69% <90.24%> (+11.69%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.