nexus-forge icon indicating copy to clipboard operation
nexus-forge copied to clipboard

'PathsWrapper' object has no attribute '_path' issue

Open MFSY opened this issue 5 years ago • 5 comments

When forge.template("Dataset") outputs:

type: { id: "" } then using:

resources = forge.search(p.type == "Dataset", limit=5)

triggers a:

'PathsWrapper' object has no attribute '_path' issue

MFSY avatar Jul 06 '20 15:07 MFSY

Hello @MFSY.

The template shouldn't have a nested value for type.

It seems forge.template(...) for RdfModel and with the example configuration (Neuroshapes) doesn't work. The output seems to be always { id: "" }.

pafonta avatar Jul 08 '20 15:07 pafonta

Hi @pafonta ,

The output seems to be always { id: "" }.

Yes.

The template shouldn't have a nested value for type.

This is an interesting question. I think forge.template() is not discriminating "type" among all the other properties. While filtering by id, label, preLabel,... for any node is desirable, filtering by just "type" usually and implicitly means filtering by the type's id.

Solution proposal :

  • forge.template() to have type as a leaf path (no type.id in the output) and consumers of the such path (the search filters mainly) to interpret the "type" path as type.id.

MFSY avatar Jul 08 '20 16:07 MFSY

Hello @MFSY

After some investigations, the type.id is required now for top level type but not for type of nested entities.

This type.id introduces then an inconsistency.

So it seems to me the issue is more in how type is handled in RdfModel.template(...) than in forge.paths(...).

Examples:

resources = forge.search(p.type.id == "Dataset", p.contribution.type == "Person", limit=3)

model-template

pafonta avatar Jul 09 '20 14:07 pafonta

By the way, test_create_templates() is part of the tests which are failing for RdfModel.

This support the idea that something went wrong for template(...) for RdfModel.

pafonta avatar Jul 10 '20 13:07 pafonta

I'm reopening this issue.

MFSY avatar Jul 10 '20 13:07 MFSY