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

[ENHANCEMENT] More support for unary operators when constructing queries #339

Open
DarthStem opened this issue Sep 20, 2024 · 1 comment
Assignees
Labels
enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one

Comments

@DarthStem
Copy link

I have need to craft queries using unary operators other than Inverse; specifically the + operator.

This need is two fold.

First, using RDFPropertyPathStep, only Inverse is supported.

.AddPropertyPath(new RDFPropertyPath(varUri, varId)
.AddAlternativeSteps(new List
{
new RDFPropertyPathStep(new RDFResource("brick:hasPart")), << Needs +
new RDFPropertyPathStep(new RDFResource("brick:isPartOf")),).Inverse() << Needs +
}))
Desired SPARQL:
?VARURI (https://brickschema.org/schema/Brick#hasPart+|^https://brickschema.org/schema/Brick#isPartOf+) ?VARID .

Second, there is no apparent way to insert unary operators when constructing filters

patternGroup.AddFilter(new RDFNotExistsFilter(new RDFPattern(
varType,
RDFVocabulary.RDFS.SUB_CLASS_OF, << Needs +
"brick:Wing")));

Desired SPARQL:
FILTER ( NOT EXISTS { ?VARTYPE http://www.w3.org/2000/01/rdf-schema#subClassOf+ https://brickschema.org/schema/Brick#Wing } )

@DarthStem DarthStem added enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one needs-triage Indicates that the request still need to be analyzed and properly classified labels Sep 20, 2024
@mdesalvo mdesalvo removed the needs-triage Indicates that the request still need to be analyzed and properly classified label Sep 21, 2024
@mdesalvo
Copy link
Owner

mdesalvo commented Sep 26, 2024

Requires an algebra for traversal of graphs and generic path evaluation, which we dont have currently.
We support property paths by transforming them in a finite and deterministic sequence of equivalent patterns (accepting sequential, alternative, inverse syntaxes). Support for non-deterministic paths (unary operators like "+", "*" and "?" which are all variants of "{MIN,MAX}" operator) is an epic for a major v4 release of the library.

Sorry to not have a workaround to propose for this. If you deal with ontologies I suggest you to try OWLSharp, which is our project specifically suited for working at OWL level: it integrates reasoning in many forms, like rdfs:subClassOf subsumption or owl:TransitiveObjectProperty inferencing which you are trying to do at lower RDF/SPARQL level.

Best regards,
Marco

@mdesalvo mdesalvo added this to the v4.0.0 milestone Sep 26, 2024
@mdesalvo mdesalvo removed this from the v4.0.0 milestone Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Indicates the need for a new feature, or the backward-compatible change of an existing one
Projects
None yet
Development

No branches or pull requests

2 participants