<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>areQueriesEquivalent — Onshape</title>
        <link>https://forum.onshape.com/</link>
        <pubDate>Tue, 14 Jul 2026 05:54:43 +0000</pubDate>
        <language>en</language>
            <description>areQueriesEquivalent — Onshape</description>
    <atom:link href="https://forum.onshape.com/discussions/tagged/arequeriesequivalent/feed.rss" rel="self" type="application/rss+xml"/>
    <item>
        <title>The areQueriesEquivalent method does not work when compared to evaluateQuery?</title>
        <link>https://forum.onshape.com/discussion/31349/the-arequeriesequivalent-method-does-not-work-when-compared-to-evaluatequery</link>
        <pubDate>Sun, 12 Jul 2026 22:03:03 +0000</pubDate>
        <category>FeatureScript</category>
        <dc:creator>charles_randolph</dc:creator>
        <guid isPermaLink="false">31349@/discussions</guid>
        <description><![CDATA[<p>I'm developing a simplistic feature that takes two inputs:</p><ol><li>A face </li><li>An edge</li></ol><p>My only constraint is that the edge belong to the face. In other words, if I query the face for all edges, I expect that the edge selected will also be in the set. To accomplish that, I've written a simple FeatureScript function called <code spellcheck="false" tabindex="0">faceContainsEdge</code></p><pre spellcheck="false" tabindex="0">function faceContainsEdge(context is Context, faceQuery is Query, edgeQuery is Query) returns boolean
precondition
{
    !isQueryEmpty(context, qEntityFilter(edge, EntityType.EDGE));
    !isQueryEmpty(context, qEntityFilter(face, EntityType.FACE));
}
{
    // Extract my edges
    const faceEdgesQuery is Query = qAdjacent(faceQuery, AdjacencyType.EDGE);
    
    // Verify whether the given edge query evaluates to one of the edges of the face
    for (var faceEdgeQuery in evaluateQuery(context, faceEdgesQuery))
    {
        if (areQueriesEquivalent(context, faceEdgeQuery, edgeQuery))
        {
            return true;
        }
    }
    return false;
}
</pre><p>The problem (obviously) is that this doesn't work. I can see via the addition of <code spellcheck="false" tabindex="0">debug</code> lines that both the <code spellcheck="false" tabindex="0">edgeQuery</code> and <code spellcheck="false" tabindex="0">faceEdgesQuery</code> evaluate correctly: </p><span data-embedjson="{&quot;url&quot;:&quot;https:\/\/us.v-cdn.net\/5022071\/uploads\/VVJ03G03JK23\/scr-20260711-oqug.png&quot;,&quot;name&quot;:&quot;SCR-20260711-oqug.png&quot;,&quot;type&quot;:&quot;image\/png&quot;,&quot;size&quot;:56294,&quot;width&quot;:1124,&quot;height&quot;:813,&quot;displaySize&quot;:&quot;large&quot;,&quot;float&quot;:&quot;none&quot;,&quot;downloadUrl&quot;:&quot;https:\/\/forum.onshape.com\/api\/v2\/media\/download-by-url?url=https%3A%2F%2Fus.v-cdn.net%2F5022071%2Fuploads%2FVVJ03G03JK23%2Fscr-20260711-oqug.png&quot;,&quot;active&quot;:true,&quot;mediaID&quot;:57140,&quot;dateInserted&quot;:&quot;2026-07-11T14:40:21+00:00&quot;,&quot;insertUserID&quot;:103702,&quot;foreignType&quot;:&quot;embed&quot;,&quot;foreignID&quot;:&quot;103702&quot;,&quot;embedType&quot;:&quot;image&quot;,&quot;embedStyle&quot;:&quot;rich_embed_card&quot;}">
    <span>
        <a href="https://us.v-cdn.net/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png" rel="nofollow noopener ugc" target="_blank">
            <img src="https://us.v-cdn.net/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png" alt="SCR-20260711-oqug.png" height="813" width="1124" data-display-size="large" data-float="none" data-type="image/png" data-embed-type="image" srcset="https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=300, width=300/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 300w, https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=600, width=600/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 600w, https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=800, width=800/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 800w, https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=1200, width=1200/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 1200w, https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=1600, width=1600/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 1600w, https://us.v-cdn.net/cdn-cgi/image/quality=80, format=auto, fit=scale-down, height=2000, width=2000/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png 2000w, https://us.v-cdn.net/5022071/uploads/VVJ03G03JK23/scr-20260711-oqug.png" sizes="100vw" /></a>
    </span>
</span>
<p>If I try to print the two queries, I see the following:</p><ol><li>Each <code spellcheck="false" tabindex="0">faceEdgeQuery</code> in the loop is a map with structure: <code spellcheck="false" tabindex="0">Query 1: { queryType : TRANSIENT , transientId : JIV }</code></li><li>The invariant <code spellcheck="false" tabindex="0">edgeQuery</code> is a map with structure: <code spellcheck="false" tabindex="0">Query 2: { queryType : UNION , subqueries : [ { flatFilter : NO , queryType : SM_FLAT_FILTER … ]</code></li></ol><p>And the function returns <code spellcheck="false" tabindex="0">false</code> always. How is this <code spellcheck="false" tabindex="0">areQueriesEquivalent</code> supposed to function? Do I need to convert the results of <code spellcheck="false" tabindex="0">evaluateQuery</code> in some way? How can I make the comparison meaningful?</p>]]>
        </description>
    </item>
   </channel>
</rss>
