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

Unexpected behaviour of forge.validate #369

Closed NicoRicardi closed 3 months ago

NicoRicardi commented 9 months ago

forge.validate(resource, type_=type_ on a test resource behaves in unexpected ways (at least to me). Let's start with:

forge = KnowledgeGraphForge('https://raw.githubusercontent.com/BlueBrain/nexus-forge/master/examples/notebooks/use-cases/prod-forge-nexus.yml',
                          token= staging_token, bucket='dke/kgforge_tests', endpoint='https://staging.nise.bbp.epfl.ch/nexus/v1')
res = forge.retrieve('https://bbp.epfl.ch/dke/kgforge_tests/66d53b15-3d20-4aa0-8e48-e43cf7a2520d')
  1. It seems to ignore the type parameter if this is not the resource.type (or in the resource.type if this is a list). As such, it would succeed with any other type in forge as type.
    res.type = 'Entity'
    forge.validate(res, type_='Entity')  # succeeds
    forge.validate(res, type_= [any valid type on forge])  # succeeds
  2. there seems to be some kind of caching returning values from previous (but different) calls . As such, the same call yields different results according to the previous calls.
    res.type = ['Entity', 'VolumetricDataLayer']
    forge.validate(res, type_='Entity')  # succeeds
    forge.validate(res, type_='VolumetricDataLayer')  # fails
    forge.validate(res, type_='Entity')  # fails, but should succeed
MFSY commented 6 months ago

Hi @NicoRicardi , This should by #393

NicoRicardi commented 6 months ago

Point 2 is fixed, indeed

MFSY commented 3 months ago

Point 1 too.