[overlord-issues] [JBoss JIRA] (ARTIF-202) The not() function doesn't quite work with relationships
Brett Meyer (JIRA)
issues at jboss.org
Thu Feb 5 12:44:49 EST 2015
[ https://issues.jboss.org/browse/ARTIF-202?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13038055#comment-13038055 ]
Brett Meyer commented on ARTIF-202:
-----------------------------------
Thanks a million to [~rhauch] for pointing this out:
Another idea is to break the relationships into groups of children. So under an artifact you'd have a child named `elements` and under that all of the relationship nodes with a type of `element`. Then finding all artifacts that have no 'element' relationship becomes something like:
{code}
SELECT artifact.* FROM [sramp:baseArtifactType] AS artifact
OUTER JOIN [sramp:relationshipContainer] AS relationshipContainer ON ISCHILDNODE(relationshipContainer,artifact)
WHERE artifact.[sramp:artifactType] = 'Part' AND
(NAME(relationshipContainer) != 'entity' OR
CHILDCOUNT(relationshipContainer) = 0)
{code}
The query needs an OUTER JOIN so that it also returns all artifacts that have no child nodes (which means it doesn't have an 'entity' relationship.
> The not() function doesn't quite work with relationships
> --------------------------------------------------------
>
> Key: ARTIF-202
> URL: https://issues.jboss.org/browse/ARTIF-202
> Project: Artificer
> Issue Type: Bug
> Reporter: Eric Wittmann
> Assignee: Brett Meyer
> Priority: Minor
>
> The not() function works well with properties, but not quite with relationships. An example of what doesn't work:
> /s-ramp/wsdl/Part[not(element)]
> That should return all Parts that do *not* have an element relationship. Since relationships are found by doing a JOIN, it's actually tricky to invert. Right now I think the query engine will produce something that would return all Parts that have some *other* relationship - but it won't return Parts without any relationships at all. I'm not sure how to do the latter other than by using an IN with a subquery (which is supported by ModeShape but is non-standard).
--
This message was sent by Atlassian JIRA
(v6.3.11#6341)
More information about the overlord-issues
mailing list