Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dn_simple_modulestructure.py fails with an exception when provided a module name that also has other similarly named requirement artifacts #61

Closed
mehtasamit opened this issue Mar 30, 2024 · 2 comments

Comments

@mehtasamit
Copy link

When running the python program dn_simple_modulestructure.py, the following exception error is raised:
More than one module with that name in project <project name> component <component name> configuraition <configuration name>

It seems that the filter parameters passed using whereterms on line 175 are only partially used - just the OSLC "title" property is matched, and second filter term, the Artifact Format type of Module, seems to be ignored.

When I made the Module name (OSLC title property) unique from all the other requirement artifact names in the component, I was able to successfully execute the program.

I was also unable to fix the whereterms even though I used the fully qualified (using the full namespace URI for jazz_rm) uri for Module Artifact format name (as returned by the query). i.e. the following change didn't work either:

   whereterms = [
        ["dcterms:title", "=", f'"{mod}"'],
        [
            "rdm_types:ArtifactFormat",
            "=",
            f'"{rdfxml.RDF_DEFAULT_PREFIX["jazz_rm"]}Module"',
        ],
    ]

@barny
Copy link
Member

barny commented Apr 16, 2024

Sorry taken me a while to get to looking at this.

There was a change in the Query implementation in IIRC 7.0.2 iFix017 which means checking for the format must use rdf:type rather than rdm_types:ArtifiactFormant, and also it seems the comparison needs an explicit URL rather than using a prefixed value.

so change

whereterms=[['dcterms:title','=',f'"{mod}"'], ['rdm_types:ArtifactFormat','=','jazz_rm:Module']],

to:

whereterms=[['dcterms:title','=',f'"{mod}"'], ['rdf:type','=','<http://jazz.net/ns/rm#Module>']],

i.e. expand the prefix on the rhs of the second erm so it's an explicit URL.

I note that oslcquery automatically does this expansion, but I wasn't aware that the OSLC API seems to require the expansion on RHS of a where term to an explicit URL.

I think (haven't tested) another way to do the prefix expansion would be like your approach but note the < and > surrounding the URL as per OSLC Query syntax
f'<{rdfxml.RDF_DEFAULT_PREFIX["jazz_rm"]}Module>'

@mehtasamit
Copy link
Author

Thanks. I was missing the angle brackets - forgot about the OSCL Query syntax for URL. Good to know that oslcquery handles this automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants