ISQL have different results with sparql endpoint

Hello.

I have the query

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX crm2: <http://sp7.ru/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT DISTINCT ?toUri ?fromUri WHERE { 
 graph ?g {
   ?ownership1 crm2:own_who ?legal_entity_owners.
        ?ownership1 crm2:own_what ?legal_entity. }
      filter (?g = <http://egrul.ru/>)
    ?legal_entity_owners crm2:pr ?res1pr.
      graph ?a { 
    ?legal_entity_owners crm2:name ?name.
        ?legal_entity_owners crm2:secondname ?secondname.}
   filter (?a = <http://egrul-name.ru/>)
    
 ?affiliation crm2:aff_legal_entity ?legal_entity.
 ?affiliation crm2:aff_organization ?company.
   
    ?ownership2 crm2:own_who ?companys_owners.
   ?ownership2 crm2:own_what ?company. 

    ?companys_owners crm2:pr ?res2pr.
    ?companys_owners crm2:name ?name.  
    ?companys_owners crm2:secondname ?secondname.

    
    FILTER (?legal_entity_owners != ?companys_owners)
    
BIND(IF(xsd:integer(?res1pr) >= xsd:integer(?res2pr), ?legal_entity_owners, ?companys_owners) as ?toUri)
BIND(IF(xsd:integer(?res1pr) < xsd:integer(?res2pr), ?legal_entity_owners, ?companys_owners) as ?fromUri)
} LIMIT 1

Sparql endpoint gives a fast response in any format (about 250ms-1.5s):

@prefix ns0:	<http://sp7.ru/ontology/> .
_:_ res:solution [
      res:binding [ res:variable "toUri" ; res:value ns0:ei_human_503108557068 ] ;
      res:binding [ res:variable "fromUri" ; res:value ns0:ei_human_feec55030ea4de946983184a55f2889e ] ] .

But ISQL-v doesn’t give any result too long (for 2 hours)

virtuoso version:

Version 7.2.6-rc1.3230-pthreads as of Aug 9 2019 (e2a413e)

virtuoso.ini:

[Database]
DatabaseFile       = /var/lib/virtuoso-opensource-7/db/virtuoso.db
ErrorLogFile       = /var/lib/virtuoso-opensource-7/db/virtuoso.log
LockFile           = /var/lib/virtuoso-opensource-7/db/virtuoso.lck
TransactionFile    = /var/lib/virtuoso-opensource-7/db/trxlog/virtuoso20190904090128.trx
xa_persistent_file = /var/lib/virtuoso-opensource-7/db/virtuoso.pxa
;DatabaseFile       = /var/lib/virtuoso/virtuoso.db
;ErrorLogFile       = /var/lib/virtuoso/virtuoso.log
;LockFile           = /var/lib/virtuoso/virtuoso.lck
;TransactionFile    = /var/lib/virtuoso/trxlog/virtuoso20181220201625.trx
;xa_persistent_file = /var/lib/virtuoso/virtuoso.pxa
ErrorLogLevel      = 7
FileExtend         = 200
MaxCheckpointRemap = 500000
Striping           = 0
TempStorage        = TempDatabase
#TransactionFile   = virtuoso20190522051400.trx

[TempDatabase]
DatabaseFile       = /var/lib/virtuoso-opensource-7/db/virtuoso-temp.db
TransactionFile    = /var/lib/virtuoso-opensource-7/db/virtuoso-temp.trx
;DatabaseFile       = /var/lib/virtuoso/virtuoso-temp.db
;TransactionFile    = /var/lib/virtuoso/virtuoso-temp.trx
MaxCheckpointRemap = 2000
Striping           = 0

;
; Server parameters
;
[Parameters]
DefaultIsolation           = 2
ServerPort                 = 1111
LiteMode                   = 0
DisableUnixSocket          = 1
DisableTcpSocket           = 0
;SSLServerPort = 2111
;SSLCertificate = cert.pem
;SSLPrivateKey = pk.pem
;X509ClientVerify = 0
;X509ClientVerifyDepth = 0
;X509ClientVerifyCAFile = ca.pem
TransactionAfterImageLimit = 99999999
MaxClientConnections       = 100
CheckpointInterval         = 60
O_DIRECT                   = 0
CaseMode                   = 2
MaxStaticCursorRows        = 5000
CheckpointAuditTrail       = 1
AllowOSCalls               = 0
SchedulerInterval          = 10
;DirsAllowed              = ., /usr/share/virtuoso/vad, /import, /EGRUL
DirsAllowed                = ., /usr/share/virtuoso-opensource-7/vad, /import, /EGRUL
ThreadCleanupInterval      = 1
ThreadThreshold            = 10
ResourcesCleanupInterval   = 1
FreeTextBatchSize          = 100000
SingleCPU                  = 0
VADInstallDir              = /usr/share/virtuoso-opensource-7/vad/
;VADInstallDir            = /usr/share/virtuoso/vad/
PrefixResultNames          = 0
RdfFreeTextRulesSize       = 100
IndexTreeMaps              = 256
;IndexTreeMaps = 256
MaxMemPoolSize             = 6000000000
;MaxMemPoolSize = 200000000
PrefixResultNames          = 0
MacSpotlight               = 0
IndexTreeMaps              = 64
MaxQueryMem                = 32G	; memory allocated to query processor
;HashJoinSpace = 8G
VectorSize                 = 10000	; initial parallel query vector (array of query operations) size
MaxVectorSize              = 3500000	; query vector size threshold.
AdjustVectorSize           = 0
ThreadsPerQuery            = 32
AsyncQueueMaxThreads       = 32
TraceOn                    = user_log, failed_log, user_names, compile, ddl_log, client_sql, errors, dsn, sql_send, transact, remote_transact, exec, soap, cursor
;;
;; When running with large data sets, one should configure the Virtuoso
;; process to use between 2/3 to 3/5 of free system memory and to stripe
;; storage on all available disks.
;;
;; Uncomment next two lines if there is 2 GB system memory free
;NumberOfBuffers = 170000
;MaxDirtyBuffers = 130000
;; Uncomment next two lines if there is 4 GB system memory free
;NumberOfBuffers = 340000
; MaxDirtyBuffers = 250000
;; Uncomment next two lines if there is 8 GB system memory free
;NumberOfBuffers = 680000
;MaxDirtyBuffers = 500000
;; Uncomment next two lines if there is 16 GB system memory free
;NumberOfBuffers = 1360000
;MaxDirtyBuffers = 1000000
;; Uncomment next two lines if there is 32 GB system memory free
;NumberOfBuffers = 2720000
;MaxDirtyBuffers = 2000000
;; Uncomment next two lines if there is 48 GB system memory free
;NumberOfBuffers = 4000000
;MaxDirtyBuffers = 3000000
;; Uncomment next two lines if there is 64 GB system memory free
;NumberOfBuffers = 5450000
;MaxDirtyBuffers = 4000000
;;
;; Note the default settings will take very little memory
;; but will not result in very good performance
;;
NumberOfBuffers            = 20710000
MaxDirtyBuffers            = 15200000
;NumberOfBuffers          = 7425000
;MaxDirtyBuffers          = 5568750

[HTTPServer]
ServerPort                  = 8190
SSLPort                     = 8890
SSLCertificate              = /data/ssl/fullchain.pem
SSLPrivateKey               = /data/ssl/privkey.pem
X509ClientVerify            = 0
ServerRoot                  = /var/lib/virtuoso-opensource-7/vsp
;ServerRoot                  = /USR/lib/virtuoso/vsp
MaxClientConnections        = 10
DavRoot                     = DAV
EnabledDavVSP               = 0
HTTPProxyEnabled            = 0
TempASPXDir                 = 0
DefaultMailServer           = localhost:25
MaxKeepAlives               = 10
KeepAliveTimeout            = 10
MaxCachedProxyConnections   = 10
ProxyConnectionCacheTimeout = 15
HTTPThreadSize              = 680000;280000
HttpPrintWarningsInOutput   = 0
Charset                     = UTF-8
;HTTPLogFile = /var/log/virtuoso/http.log
MaintenancePage             = atomic.html
EnabledGzipContent          = 1

[AutoRepair]
BadParentLinks = 0

[Client]
SQL_PREFETCH_ROWS  = 100
SQL_PREFETCH_BYTES = 16000
SQL_QUERY_TIMEOUT  = 0
SQL_TXN_TIMEOUT    = 0
;SQL_NO_CHAR_C_ESCAPE = 1
;SQL_UTF8_EXECS = 0
;SQL_NO_SYSTEM_TABLES = 0
;SQL_BINARY_TIMESTAMP = 1
;SQL_ENCRYPTION_ON_PASSWORD = -1

[VDB]
ArrayOptimization           = 0
NumArrayParameters          = 10
VDBDisconnectTimeout        = 1000
KeepConnectionOnFixedThread = 0

[Replication]
;ServerName   = db-CE05D567F527
;ServerEnable = 1
;QueueMax     = 50000

;
; Striping setup
;
; These parameters have only effect when Striping is set to 1 in the
; [Database] section, in which case the DatabaseFile parameter is ignored.
;
; With striping, the database is spawned across multiple segments
; where each segment can have multiple stripes.
;
; Format of the lines below:
; Segment<number> = <size>, <stripe file name> [, <stripe file name> .. ]
;
; <number> must be ordered from 1 up.
;
; The <size> is the total size of the segment which is equally divided
; across all stripes forming the segment. Its specification can be in
; gigabytes (g), megabytes (m), kilobytes (k) or in database blocks
; (b, the default)
;
; Note that the segment size must be a multiple of the database page size
; which is currently 8k. Also, the segment size must be divisible by the
; number of stripe files forming the segment.
;
; The example below creates a 200 meg database striped on two segments
; with two stripes of 50 meg and one of 100 meg.
;
; You can always add more segments to the configuration, but once
; added, do not change the setup.
;
[Striping]
Segment1 = 100M, db-seg1-1.db, db-seg1-2.db
Segment2 = 100M, db-seg2-1.db
;...
;[TempStriping]
;Segment1 = 100M, db-seg1-1.db, db-seg1-2.db
;Segment2 = 100M, db-seg2-1.db
;...
;[Ucms]
;UcmPath = <path>
;Ucm1 = <file>
;Ucm2 = <file>
;...

[Zero Config]
ServerName = virtuoso (CE05D567F527)
;ServerDSN = ZDSN
;SSLServerName =
;SSLServerDSN =

[Mono]
;MONO_TRACE = Off
;MONO_PATH = <path_here>
;MONO_ROOT = <path_here>
;MONO_CFG_DIR = <path_here>
;virtclr.dll =

[URIQA]
DynamicLocal = 0
DefaultHost  = localhost:8890

[SPARQL]
;ExternalQuerySource = 1
;ExternalXsltSource = 1
;DefaultGraph = http://localhost:8890/dataspace
;ImmutableGraphs = http://localhost:8890/dataspace
ResultSetMaxRows           = 1000
MaxQueryCostEstimationTime = 60000	; in seconds
MaxQueryExecutionTime      = 0	; in seconds
DefaultQuery               = PREFIX crm2: <http://sp7.ru/ontology/> SELECT * WHERE { ?a ?sp crm2:Organization. ?sp rdf:singletonPropertyOf rdf:type. } LIMIT 100
DeferInferenceRulesInit    = 0	; controls inference rules loading
;PingService = http://rpc.pingthesemanticweb.com/

[Plugins]
LoadPath = /usr/lib/virtuoso-opensource-7/hosting
;LoadPath = /usr/lib/virtuoso/hosting
Load1    = plain, wikiv
Load2    = plain, mediawiki
Load3    = plain, creolewiki
Load4    = plain, im
;Load5 = plain, wbxml2
;Load6 = plain, hslookup
;Load7 = attach, libphp5.so
;Load8 = Hosting, hosting_php.so
;Load9 = Hosting,hosting_perl.so
;Load10 = Hosting,hosting_python.so
;Load11 = Hosting,hosting_ruby.so
;Load12 = msdtc,msdtc_sample

DEBUG REPORT from endpoint:

SPARQL query after parsing, optimization, and converting back into SPARQL
SELECT DISTINCT  ?toUri
 ?fromUri
 WHERE { 
      { SELECT  ?g
         ?ownership1
         ?legal_entity_owners
         ?legal_entity
         ?res1pr
         ?a
         ?name
         ?secondname
         ?affiliation
         ?company
         ?ownership2
         ?companys_owners
         ?res2pr
          ( if( <http://www.w3.org/2001/XMLSchema#integer>( ?res2pr) <=  <http://www.w3.org/2001/XMLSchema#integer>( ?res1pr), ?legal_entity_owners, ?companys_owners) AS ?toUri)
          ( if( <http://www.w3.org/2001/XMLSchema#integer>( ?res1pr) <  <http://www.w3.org/2001/XMLSchema#integer>( ?res2pr), ?legal_entity_owners, ?companys_owners) AS ?fromUri)
         WHERE { 
             GRAPH ?g { ?ownership1 <http://sp7.ru/ontology/own_who> ?legal_entity_owners ;
                     <http://sp7.ru/ontology/own_what> ?legal_entity . } ?legal_entity_owners <http://sp7.ru/ontology/pr> ?res1pr .
             GRAPH ?a { ?legal_entity_owners <http://sp7.ru/ontology/name> ?name ;
                     <http://sp7.ru/ontology/secondname> ?secondname . } ?affiliation <http://sp7.ru/ontology/aff_legal_entity> ?legal_entity ;
                 <http://sp7.ru/ontology/aff_organization> ?company . ?ownership2 <http://sp7.ru/ontology/own_who> ?companys_owners ;
                 <http://sp7.ru/ontology/own_what> ?company . ?companys_owners <http://sp7.ru/ontology/pr> ?res2pr ;
                 <http://sp7.ru/ontology/name> ?name ;
                 <http://sp7.ru/ontology/secondname> ?secondname . }
        OFFSET  0 }
     FILTER (?g =  <http://egrul.ru/>)
     FILTER (?a =  <http://egrul-name.ru/>)
    FILTER ( ?legal_entity_owners !=  ?companys_owners ) }
LIMIT  1
SPARQL query translated to SQL
For security reasons, code responsible for graph-level security is not generated and some account-specific data are intentionally made wrong.
 SELECT  __ro2sq ("s_33_24_rbc"."toUri") AS "toUri", __ro2sq ("s_33_24_rbc"."fromUri") AS "fromUri" FROM (SELECT DISTINCT TOP 1 "s_32_23"."toUri" AS "toUri",
    "s_32_23"."fromUri" AS "fromUri"
  FROM (
     SELECT "s_10_2_t1"."G" AS "g",
        "s_10_2_t1"."S" AS "ownership1",
        "s_32_22_t4"."S" AS "legal_entity_owners",
        "s_32_22_t5"."O" AS "legal_entity",
        "s_32_22_t4"."O" AS "res1pr",
        "s_15_7_t3"."G" AS "a",
        "s_32_22_t10"."O" AS "name",
        "s_32_22_t11"."O" AS "secondname",
        "s_32_22_t5"."S" AS "affiliation",
        "s_32_22_t6"."O" AS "company",
        "s_32_22_t7"."S" AS "ownership2",
        "s_32_22_t7"."O" AS "companys_owners",
        "s_32_22_t9"."O" AS "res2pr",
        case when ( lte (  CAST ( __ro2sq ( "s_32_22_t9"."O") AS INTEGER),   CAST ( __ro2sq ( "s_32_22_t4"."O") AS INTEGER))) then ( "s_32_22_t4"."S") else ( "s_32_22_t7"."O") end AS "toUri",
        case when ( lt (  CAST ( __ro2sq ( "s_32_22_t4"."O") AS INTEGER),   CAST ( __ro2sq ( "s_32_22_t9"."O") AS INTEGER))) then ( "s_32_22_t4"."S") else ( "s_32_22_t7"."O") end AS "fromUri"
      FROM DB.DBA.RDF_QUAD AS "s_10_2_t0"
        INNER JOIN DB.DBA.RDF_QUAD AS "s_10_2_t1"
        ON (
          "s_10_2_t1"."G" = "s_10_2_t0"."G"
          AND 
          "s_10_2_t1"."S" = "s_10_2_t0"."S")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t4"
        ON (
          "s_32_22_t4"."S" = "s_10_2_t0"."O")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_15_7_t2"
        ON (
          "s_32_22_t4"."S" = "s_15_7_t2"."S"
          AND 
          "s_15_7_t2"."S" = "s_10_2_t0"."O")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_15_7_t3"
        ON (
          "s_32_22_t4"."S" = "s_15_7_t3"."S"
          AND 
          "s_15_7_t3"."S" = "s_15_7_t2"."S"
          AND 
          "s_15_7_t3"."S" = "s_10_2_t0"."O"
          AND 
          "s_15_7_t3"."G" = "s_15_7_t2"."G")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t5"
        ON (
          "s_32_22_t5"."O" = "s_10_2_t1"."O")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t6"
        ON (
          "s_32_22_t5"."S" = "s_32_22_t6"."S")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t7"
        ON (1)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t8"
        ON (
          "s_32_22_t6"."O" = "s_32_22_t8"."O"
          AND 
          "s_32_22_t7"."S" = "s_32_22_t8"."S")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t9"
        ON (
          "s_32_22_t7"."O" = "s_32_22_t9"."S")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t10"
        ON (
          "s_32_22_t7"."O" = "s_32_22_t10"."S"
          AND 
          "s_32_22_t9"."S" = "s_32_22_t10"."S"
          AND 
          "s_32_22_t10"."O" = "s_15_7_t2"."O")
        INNER JOIN DB.DBA.RDF_QUAD AS "s_32_22_t11"
        ON (
          "s_32_22_t7"."O" = "s_32_22_t11"."S"
          AND 
          "s_32_22_t9"."S" = "s_32_22_t11"."S"
          AND 
          "s_32_22_t10"."S" = "s_32_22_t11"."S"
          AND 
          "s_32_22_t11"."O" = "s_15_7_t3"."O")
      WHERE
        "s_10_2_t0"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
        AND 
        "s_10_2_t1"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
        AND 
        "s_32_22_t4"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/pr' , 1))
        AND 
        "s_15_7_t2"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/name' , 1))
        AND 
        "s_15_7_t3"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/secondname' , 1))
        AND 
        "s_32_22_t5"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_legal_entity' , 1))
        AND 
        "s_32_22_t6"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_organization' , 1))
        AND 
        "s_32_22_t7"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
        AND 
        "s_32_22_t8"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
        AND 
        "s_32_22_t9"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/pr' , 1))
        AND 
        "s_32_22_t10"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/name' , 1))
        AND 
        "s_32_22_t11"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/secondname' , 1))
OPTION (QUIETCAST)
      ) AS "s_32_23"
  WHERE
   ( "s_32_23"."g" =  __i2idn ( /* UNAME as sqlval */ __bft ( 'http://egrul.ru/' , 1)))
    AND 
   ( "s_32_23"."a" =  __i2idn ( /* UNAME as sqlval */ __bft ( 'http://egrul-name.ru/' , 1)))
    AND 
   ( "s_32_23"."legal_entity_owners" <>  "s_32_23"."companys_owners")
OPTION (QUIETCAST)) AS "s_33_24_rbc"
SQL execution plan
  { 
    Subquery 27 
      { 
        RDF_QUAD_POGS   2.6e+07 rows(t3.O$34, t3.G$33, t3.S$32)
         inlined  P =  IRI_ID"...own_who" 
        RDF_QUAD         1 rows(t7.S$39, t7.G$38, t7.O$37)
         inlined  P =  IRI_ID"...secondname"  ,  S = cast$150 G =  IRI_ID"..." 
        RDF_QUAD         1 rows(t6.S$43, t6.O$42)
         inlined  P =  IRI_ID"...name"  ,  S = k_t3.O$162 G = t7.G$38
        RDF_QUAD         1 rows(t5.S$47, t5.O$46)
         inlined  P =  IRI_ID"...pr"  ,  S = k_t3.O$173
        RDF_QUAD_POGS        24 rows(t14.S$50)
         P =  IRI_ID"...secondname"  ,  O = k_t7.O$184
        RDF_QUAD   5.5e-07 rows(t13.S$53)
         inlined  P =  IRI_ID"...name"  ,  S = t14.S$50 ,  O = k_t6.O$194
        RDF_QUAD         1 rows(t12.S$57, t12.O$56)
         inlined  P =  IRI_ID"...pr"  ,  S = t13.S$53
        Precode:
          0: __all_eq$59 := Call __all_eq (t3.G$33,  IRI_ID"..." )
          5: BReturn 0
        RDF_QUAD_POGS       1.7 rows(t10.O$63, t10.S$62)
         P =  IRI_ID"...own_who"  ,  O = cast$211
        END Node
        After test:
        0: if (t5.S$47 = t10.O$63) then 5 else 4 unkn 5
        4: BReturn 1
        5: BReturn 0
        RDF_QUAD         1 rows(t4.O$66)
         inlined  P =  IRI_ID"...own_what"  ,  S = k_t3.S$227 G = k___all_eq$231
        RDF_QUAD_POGS       6.1 rows(t8.S$69)
         P =  IRI_ID"...aff_legal_entity"  ,  O = cast$239
        RDF_QUAD         1 rows(t9.O$72)
         inlined  P =  IRI_ID"...aff_organization"  ,  S = t8.S$69
        RDF_QUAD_POGS   5.9e-08 rows()
         inlined  P =  IRI_ID"...own_what"  ,  O = cast$255 ,  S = k_t10.S$259
        
        After code:
        0: __ro2sq$78 := Call __ro2sq (t5.O$46)
        5: _cvt$80 := Call _cvt (<tag 193 flag 0>, __ro2sq$78)
        10: __ro2sq$82 := Call __ro2sq (t12.O$56)
        15: _cvt$84 := Call _cvt (<tag 193 flag 0>, __ro2sq$82)
        20: lt$86 := Call lt (_cvt$80, _cvt$84)
        25: if ( 0  = lt$86) then 34 else 29 unkn 34
        29: callretSearchedCASE$76 :=  := artm t5.S$47
        33: Jump 38 (level=0)
        34: callretSearchedCASE$76 :=  := artm t10.O$63
        38: __ro2sq$90 := Call __ro2sq (t12.O$56)
        43: _cvt$92 := Call _cvt (<tag 193 flag 0>, __ro2sq$90)
        48: __ro2sq$94 := Call __ro2sq (t5.O$46)
        53: _cvt$96 := Call _cvt (<tag 193 flag 0>, __ro2sq$94)
        58: lte$98 := Call lte (_cvt$92, _cvt$96)
        63: if ( 0  = lte$98) then 72 else 67 unkn 72
        67: callretSearchedCASE$88 :=  := artm t5.S$47
        71: Jump 76 (level=0)
        72: callretSearchedCASE$88 :=  := artm t10.O$63
        76: BReturn 0
        Distinct (callretSearchedCASE$88, callretSearchedCASE$76)
        skip node  1  <none> set_no$30
        
        After code:
        0: toUri$28 :=  := artm callretSearchedCASE$88
        4: fromUri$29 :=  := artm callretSearchedCASE$76
        8: BReturn 0
        Subquery Select(toUri$28, fromUri$29)
      }
    
    After code:
    0: toUri$116 := Call __ro2sq (toUri$28)
    5: fromUri$118 := Call __ro2sq (fromUri$29)
    10: BReturn 0
    Select (toUri$116, fromUri$118)
  }
Internal optimizer data
These data are primarily for OpenLink support, to get additional details about the query processing.
	QUERY: (line 33) REQUEST TOP NODE (SELECT DISTINCT result-mode):
  RETVALS: ARRAY OF NODES with 2 children: {
    (line 6) VARIABLE: notNULL reference exported
      NAME: UNAME `toUri'	SELECT ID: STRING `s_33_24'	TABLE ID: LONG 0	EQUIV: LONG 48
    (line 6) VARIABLE: notNULL reference exported
      NAME: UNAME `fromUri'	SELECT ID: STRING `s_33_24'	TABLE ID: LONG 0	EQUIV: LONG 49
   }
  RETVALS SELECT ID: STRING `s_33_24'
  SOURCES: EMPTY ARRAY
  PATTERN: (line 33) GRAPH PATTERN:WHERE gp
    MEMBERS: ARRAY OF NODES with 1 children: {
      (line 32) GRAPH PATTERN:SELECT result-mode
        MEMBERS: EMPTY ARRAY
        SUBQUERY: (line 32) REQUEST TOP NODE (SELECT result-mode):
          VALMODE FOR RETVALS: STRING `AUTO'
          RETVALS: ARRAY OF NODES with 15 children: {
            (line 0) ALIAS:
              ALIAS NAME: UNAME `g'
              VALUE: (line 32) VARIABLE: notNULL IRI reference exported
                NAME: UNAME `g'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 26
            (line 0) ALIAS:
              ALIAS NAME: UNAME `ownership1'
              VALUE: (line 32) VARIABLE: notNULL reference exported
                NAME: UNAME `ownership1'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 27
            (line 0) ALIAS:
              ALIAS NAME: UNAME `legal_entity_owners'
              VALUE: (line 32) VARIABLE: notNULL reference exported
                NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 5
            (line 0) ALIAS:
              ALIAS NAME: UNAME `legal_entity'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `legal_entity'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 13
            (line 0) ALIAS:
              ALIAS NAME: UNAME `res1pr'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `res1pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 6
            (line 0) ALIAS:
              ALIAS NAME: UNAME `a'
              VALUE: (line 32) VARIABLE: notNULL IRI reference exported
                NAME: UNAME `a'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 28
            (line 0) ALIAS:
              ALIAS NAME: UNAME `name'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `name'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 23
            (line 0) ALIAS:
              ALIAS NAME: UNAME `secondname'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `secondname'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 25
            (line 0) ALIAS:
              ALIAS NAME: UNAME `affiliation'
              VALUE: (line 32) VARIABLE: notNULL reference exported
                NAME: UNAME `affiliation'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 12
            (line 0) ALIAS:
              ALIAS NAME: UNAME `company'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `company'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 15
            (line 0) ALIAS:
              ALIAS NAME: UNAME `ownership2'
              VALUE: (line 32) VARIABLE: notNULL reference exported
                NAME: UNAME `ownership2'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 17
            (line 0) ALIAS:
              ALIAS NAME: UNAME `companys_owners'
              VALUE: (line 32) VARIABLE: notNULL reference exported
                NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 18
            (line 0) ALIAS:
              ALIAS NAME: UNAME `res2pr'
              VALUE: (line 32) VARIABLE: notNULL exported
                NAME: UNAME `res2pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 21
            (line 30) ALIAS:
              ALIAS NAME: UNAME `toUri'
              VALUE: (line 30) BUILT-IN CALL:if
                ARGUMENT: ARRAY OF NODES with 3 children: {
                  (line 30) OPERATOR EXPRESSION (boolean operation '<='):
                    LEFT: (line 30) FUNCALL:
                      FUNCTION NAME: UNAME `xpath:http://www.w3.org/2001/XMLSchema#:integer'
                      ARGUMENT: (line 30) VARIABLE: notNULL exported
                        NAME: UNAME `res2pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 21
                    RIGHT: (line 30) FUNCALL:
                      FUNCTION NAME: UNAME `xpath:http://www.w3.org/2001/XMLSchema#:integer'
                      ARGUMENT: (line 30) VARIABLE: notNULL exported
                        NAME: UNAME `res1pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 6
                  (line 30) VARIABLE: notNULL reference exported
                    NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 5
                  (line 30) VARIABLE: notNULL reference exported
                    NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 18
                 }
            (line 31) ALIAS:
              ALIAS NAME: UNAME `fromUri'
              VALUE: (line 31) BUILT-IN CALL:if
                ARGUMENT: ARRAY OF NODES with 3 children: {
                  (line 31) OPERATOR EXPRESSION (boolean operation '<'):
                    LEFT: (line 31) FUNCALL:
                      FUNCTION NAME: UNAME `xpath:http://www.w3.org/2001/XMLSchema#:integer'
                      ARGUMENT: (line 31) VARIABLE: notNULL exported
                        NAME: UNAME `res1pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 6
                    RIGHT: (line 31) FUNCALL:
                      FUNCTION NAME: UNAME `xpath:http://www.w3.org/2001/XMLSchema#:integer'
                      ARGUMENT: (line 31) VARIABLE: notNULL exported
                        NAME: UNAME `res2pr'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 21
                  (line 31) VARIABLE: notNULL reference exported
                    NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 5
                  (line 31) VARIABLE: notNULL reference exported
                    NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: LONG 0	EQUIV: LONG 18
                 }
           }
          RETVALS SELECT ID: STRING `s_32_22'
          SOURCES: EMPTY ARRAY
          PATTERN: (line 32) GRAPH PATTERN:WHERE gp
            MEMBERS: ARRAY OF NODES with 12 children: {
              (line 8) TRIPLE:
                GRAPH: (line 7) VARIABLE: notNULL+ IRI+ reference+ exported (graph)
                  NAME: UNAME `g'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t0'	EQUIV: LONG 26
                SUBJECT: (line 8) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `ownership1'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t0'	EQUIV: LONG 27
                PREDICATE: (line 8) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/own_who'
                OBJECT: (line 8) VARIABLE: notNULL+ reference exported (object)
                  NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t0'	EQUIV: LONG 5
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_10_2_t0'
              (line 9) TRIPLE:
                GRAPH: (line 7) VARIABLE: notNULL+ IRI+ reference+ exported (graph)
                  NAME: UNAME `g'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t1'	EQUIV: LONG 26
                SUBJECT: (line 9) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `ownership1'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t1'	EQUIV: LONG 27
                PREDICATE: (line 9) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/own_what'
                OBJECT: (line 9) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `legal_entity'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_10_2_t1'	EQUIV: LONG 13
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_10_2_t1'
              (line 11) TRIPLE:
                GRAPH: (line 11) BLANK NODE:	NAME: STRING `_::default_11_3'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t4'
                SUBJECT: (line 11) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t4'	EQUIV: LONG 5
                PREDICATE: (line 11) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/pr'
                OBJECT: (line 11) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `res1pr'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t4'	EQUIV: LONG 6
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t4'
              (line 13) TRIPLE:
                GRAPH: (line 12) VARIABLE: notNULL+ IRI+ reference+ exported (graph)
                  NAME: UNAME `a'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t2'	EQUIV: LONG 28
                SUBJECT: (line 13) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t2'	EQUIV: LONG 5
                PREDICATE: (line 13) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/name'
                OBJECT: (line 13) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `name'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t2'	EQUIV: LONG 23
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_15_7_t2'
              (line 14) TRIPLE:
                GRAPH: (line 12) VARIABLE: notNULL+ IRI+ reference+ exported (graph)
                  NAME: UNAME `a'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t3'	EQUIV: LONG 28
                SUBJECT: (line 14) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t3'	EQUIV: LONG 5
                PREDICATE: (line 14) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/secondname'
                OBJECT: (line 14) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `secondname'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_15_7_t3'	EQUIV: LONG 25
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_15_7_t3'
              (line 17) TRIPLE:
                GRAPH: (line 17) BLANK NODE:	NAME: STRING `_::default_17_8'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t5'
                SUBJECT: (line 17) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `affiliation'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t5'	EQUIV: LONG 12
                PREDICATE: (line 17) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/aff_legal_entity'
                OBJECT: (line 17) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `legal_entity'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t5'	EQUIV: LONG 13
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t5'
              (line 18) TRIPLE:
                GRAPH: (line 18) BLANK NODE:	NAME: STRING `_::default_18_10'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t6'
                SUBJECT: (line 18) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `affiliation'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t6'	EQUIV: LONG 12
                PREDICATE: (line 18) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/aff_organization'
                OBJECT: (line 18) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `company'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t6'	EQUIV: LONG 15
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t6'
              (line 20) TRIPLE:
                GRAPH: (line 20) BLANK NODE:	NAME: STRING `_::default_20_12'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t7'
                SUBJECT: (line 20) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `ownership2'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t7'	EQUIV: LONG 17
                PREDICATE: (line 20) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/own_who'
                OBJECT: (line 20) VARIABLE: notNULL+ reference exported (object)
                  NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t7'	EQUIV: LONG 18
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t7'
              (line 21) TRIPLE:
                GRAPH: (line 21) BLANK NODE:	NAME: STRING `_::default_21_14'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t8'
                SUBJECT: (line 21) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `ownership2'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t8'	EQUIV: LONG 17
                PREDICATE: (line 21) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/own_what'
                OBJECT: (line 21) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `company'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t8'	EQUIV: LONG 15
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t8'
              (line 23) TRIPLE:
                GRAPH: (line 23) BLANK NODE:	NAME: STRING `_::default_23_16'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t9'
                SUBJECT: (line 23) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t9'	EQUIV: LONG 18
                PREDICATE: (line 23) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/pr'
                OBJECT: (line 23) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `res2pr'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t9'	EQUIV: LONG 21
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t9'
              (line 24) TRIPLE:
                GRAPH: (line 24) BLANK NODE:	NAME: STRING `_::default_24_18'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t10'
                SUBJECT: (line 24) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t10'	EQUIV: LONG 18
                PREDICATE: (line 24) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/name'
                OBJECT: (line 24) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `name'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t10'	EQUIV: LONG 23
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t10'
              (line 25) TRIPLE:
                GRAPH: (line 25) BLANK NODE:	NAME: STRING `_::default_25_20'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t11'
                SUBJECT: (line 25) VARIABLE: notNULL+ reference+ exported (subject)
                  NAME: UNAME `companys_owners'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t11'	EQUIV: LONG 18
                PREDICATE: (line 25) QNAME:
                  IRI: UNAME `http://sp7.ru/ontology/secondname'
                OBJECT: (line 25) VARIABLE: notNULL+ exported (object)
                  NAME: UNAME `secondname'	SELECT ID: STRING `s_32_22'	TABLE ID: STRING `s_32_22_t11'	EQUIV: LONG 25
                SELECT ID: STRING `s_32_22'
                TABLE ID: STRING `s_32_22_t11'
             }
            FILTERS: EMPTY ARRAY
            SELECT ID: STRING `s_32_22'
            EQUIVS: 4 5 6 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
          OFFSET: LONG 0
        FILTERS: EMPTY ARRAY
        SELECT ID: STRING `s_32_23'
        EQUIVS: 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
     }
    FILTERS: ARRAY OF NODES with 1 children: {
      (line 28) OPERATOR EXPRESSION (boolean operation '!='):
        LEFT: (line 28) VARIABLE: notNULL reference exported
          NAME: UNAME `legal_entity_owners'	SELECT ID: STRING `s_33_24'	TABLE ID: LONG 0	EQUIV: LONG 46
        RIGHT: (line 28) VARIABLE: notNULL reference exported
          NAME: UNAME `companys_owners'	SELECT ID: STRING `s_33_24'	TABLE ID: LONG 0	EQUIV: LONG 47
     }
    SELECT ID: STRING `s_33_24'
    EQUIVS: 44 45 46 47 48 49
  LIMIT: LONG 1

EQUIVS:
#0: merged and destroyed
#1: merged and destroyed
#2: merged and destroyed
#3: merged and destroyed
#4: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_11_3 in s_32_22_t4; notNULL IRI reference)
#5: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 4 gspo, 3 const, 0 opt, 0 subq: legal_entity_owners in s_32_22_t4 s_32_22 s_32_22 s_32_22 s_15_7_t3 s_15_7_t2 s_10_2_t0; notNULL reference exported)
#6: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 3 const, 0 opt, 0 subq: res1pr in s_32_22_t4 s_32_22 s_32_22 s_32_22; notNULL exported)
#7: merged and destroyed
#8: merged and destroyed
#9: merged and destroyed
#10: merged and destroyed
#11: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_17_8 in s_32_22_t5; notNULL IRI reference)
#12: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: affiliation in s_32_22_t5 s_32_22_t6 s_32_22; notNULL reference exported)
#13: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: legal_entity in s_32_22_t5 s_32_22 s_10_2_t1; notNULL exported)
#14: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_18_10 in s_32_22_t6; notNULL IRI reference)
#15: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: company in s_32_22_t6 s_32_22_t8 s_32_22; notNULL exported)
#16: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_20_12 in s_32_22_t7; notNULL IRI reference)
#17: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: ownership2 in s_32_22_t7 s_32_22_t8 s_32_22; notNULL reference exported)
#18: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 4 gspo, 3 const, 0 opt, 0 subq: companys_owners in s_32_22_t7 s_32_22_t9 s_32_22_t10 s_32_22_t11 s_32_22 s_32_22 s_32_22; notNULL reference exported)
#19: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_21_14 in s_32_22_t8; notNULL IRI reference)
#20: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_23_16 in s_32_22_t9; notNULL IRI reference)
#21: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 3 const, 0 opt, 0 subq: res2pr in s_32_22_t9 s_32_22 s_32_22 s_32_22; notNULL exported)
#22: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_24_18 in s_32_22_t10; notNULL IRI reference)
#23: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: name in s_32_22_t10 s_32_22 s_15_7_t2; notNULL exported)
#24: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 1 gspo, 0 const, 0 opt, 0 subq: _::default_25_20 in s_32_22_t11; notNULL IRI reference)
#25: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: secondname in s_32_22_t11 s_32_22 s_15_7_t3; notNULL exported)
#26: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: g in s_32_22 s_10_2_t1 s_10_2_t0; notNULL IRI reference exported)
#27: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: ownership1 in s_32_22 s_10_2_t1 s_10_2_t0; notNULL reference exported)
#28: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 2 gspo, 1 const, 0 opt, 0 subq: a in s_32_22 s_15_7_t3 s_15_7_t2; notNULL IRI reference exported)
#29: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: g in; notNULL IRI reference exported)
#30: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: ownership1 in; notNULL reference exported)
#31: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: legal_entity_owners in; notNULL reference exported)
#32: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: legal_entity in; notNULL exported)
#33: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: res1pr in; notNULL exported)
#34: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: a in; notNULL IRI reference exported)
#35: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: name in; notNULL exported)
#36: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: secondname in; notNULL exported)
#37: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: affiliation in; notNULL reference exported)
#38: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: company in; notNULL exported)
#39: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: ownership2 in; notNULL reference exported)
#40: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: companys_owners in; notNULL reference exported)
#41: ( 0 subv (0 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 1 subq: res2pr in; notNULL exported)
#42: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: toUri in; notNULL reference)
#43: ( 0 subv (0 bindings, 0 nest.opt.), 1 recv, 0 gspo, 0 const, 0 opt, 1 subq: fromUri in; notNULL reference)
#44: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 0 subq: g in; notNULL! fixed! IRI reference exported; fixed UNAME 'http://egrul.ru/')
#45: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 0 const, 0 opt, 0 subq: a in; notNULL! fixed! IRI reference exported; fixed UNAME 'http://egrul-name.ru/')
#46: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 1 const, 0 opt, 0 subq: legal_entity_owners in s_33_24; notNULL reference exported)
#47: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 1 const, 0 opt, 0 subq: companys_owners in s_33_24; notNULL reference exported)
#48: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 1 const, 0 opt, 0 subq: toUri in s_33_24; notNULL reference exported)
#49: ( 1 subv (1 bindings, 0 nest.opt.), 0 recv, 0 gspo, 1 const, 0 opt, 0 subq: fromUri in s_33_24; notNULL reference exported)

Why isql-v have different results?

Sparql translate from isql-v:

SELECT  __ro2sq ("s_1_24_rbc"."toUri") AS "toUri", __ro2sq ("s_1_24_rbc"."fromUri") AS "fromUri" FROM (SELECT DISTINCT TOP 1 /* retval[ */ "s_1_23"."toUri" /* toUri */ /* ]retval */ AS /* retval */ "toUri",
    /* retval[ */ "s_1_23"."fromUri" /* fromUri */ /* ]retval */ AS /* retval */ "fromUri"
  FROM ( /* subq begin */
     SELECT /* retval[ */ "s_1_2_t1"."G" /* g */ /* ]retval */ AS /* retval */ "g",
        /* retval[ */ "s_1_2_t1"."S" /* ownership1 */ /* ]retval */ AS /* retval */ "ownership1",
        /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */ AS /* retval */ "legal_entity_owners",
        /* retval[ */ "s_1_22_t5"."O" /* legal_entity */ /* ]retval */ AS /* retval */ "legal_entity",
        /* retval[ */ "s_1_22_t4"."O" /* res1pr */ /* ]retval */ AS /* retval */ "res1pr",
        /* retval[ */ "s_1_7_t3"."G" /* a */ /* ]retval */ AS /* retval */ "a",
        /* retval[ */ "s_1_22_t10"."O" /* name */ /* ]retval */ AS /* retval */ "name",
        /* retval[ */ "s_1_22_t11"."O" /* secondname */ /* ]retval */ AS /* retval */ "secondname",
        /* retval[ */ "s_1_22_t5"."S" /* affiliation */ /* ]retval */ AS /* retval */ "affiliation",
        /* retval[ */ "s_1_22_t6"."O" /* company */ /* ]retval */ AS /* retval */ "company",
        /* retval[ */ "s_1_22_t7"."S" /* ownership2 */ /* ]retval */ AS /* retval */ "ownership2",
        /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */ AS /* retval */ "companys_owners",
        /* retval[ */ "s_1_22_t9"."O" /* res2pr */ /* ]retval */ AS /* retval */ "res2pr",
        case when ( lte (  CAST ( __ro2sq ( /* retval[ */ "s_1_22_t9"."O" /* res2pr */ /* ]retval */) AS  /* xqf parser funcall */INTEGER),   CAST ( __ro2sq ( /* retval[ */ "s_1_22_t4"."O" /* res1pr */ /* ]retval */) AS  /* xqf parser funcall */INTEGER))) then ( /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */) else ( /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */) end AS /* builtin */ "toUri",
        case when ( lt (  CAST ( __ro2sq ( /* retval[ */ "s_1_22_t4"."O" /* res1pr */ /* ]retval */) AS  /* xqf parser funcall */INTEGER),   CAST ( __ro2sq ( /* retval[ */ "s_1_22_t9"."O" /* res2pr */ /* ]retval */) AS  /* xqf parser funcall */INTEGER))) then ( /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */) else ( /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */) end AS /* builtin */ "fromUri"
      FROM DB.DBA.RDF_QUAD AS "s_1_2_t0"
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_2_t1"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_2_t1"."G" /* g */ /* ]retval */ = /* retval[ */ "s_1_2_t0"."G" /* g */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_2_t1"."S" /* ownership1 */ /* ]retval */ = /* retval[ */ "s_1_2_t0"."S" /* ownership1 */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t4"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_2_t0"."O" /* legal_entity_owners */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_7_t2"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_7_t2"."S" /* legal_entity_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_7_t2"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_2_t0"."O" /* legal_entity_owners */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_7_t3"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t4"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_7_t3"."S" /* legal_entity_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_7_t3"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_7_t2"."S" /* legal_entity_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_7_t3"."S" /* legal_entity_owners */ /* ]retval */ = /* retval[ */ "s_1_2_t0"."O" /* legal_entity_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_7_t3"."G" /* a */ /* ]retval */ = /* retval[ */ "s_1_7_t2"."G" /* a */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t5"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t5"."O" /* legal_entity */ /* ]retval */ = /* retval[ */ "s_1_2_t1"."O" /* legal_entity */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t6"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t5"."S" /* affiliation */ /* ]retval */ = /* retval[ */ "s_1_22_t6"."S" /* affiliation */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t7"
        ON (1)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t8"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t6"."O" /* company */ /* ]retval */ = /* retval[ */ "s_1_22_t8"."O" /* company */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t7"."S" /* ownership2 */ /* ]retval */ = /* retval[ */ "s_1_22_t8"."S" /* ownership2 */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t9"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t9"."S" /* companys_owners */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t10"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t10"."S" /* companys_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t9"."S" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t10"."S" /* companys_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t10"."O" /* name */ /* ]retval */ = /* retval[ */ "s_1_7_t2"."O" /* name */ /* ]retval */)
        INNER JOIN DB.DBA.RDF_QUAD AS "s_1_22_t11"
        ON ( /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t7"."O" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t11"."S" /* companys_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t9"."S" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t11"."S" /* companys_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t10"."S" /* companys_owners */ /* ]retval */ = /* retval[ */ "s_1_22_t11"."S" /* companys_owners */ /* ]retval */
          AND  /* two fields belong to same equiv */
          /* retval[ */ "s_1_22_t11"."O" /* secondname */ /* ]retval */ = /* retval[ */ "s_1_7_t3"."O" /* secondname */ /* ]retval */)
      WHERE /* field equal to URI ref */
        "s_1_2_t0"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
        AND  /* field equal to URI ref */
        "s_1_2_t1"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t4"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/pr' , 1))
        AND  /* field equal to URI ref */
        "s_1_7_t2"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/name' , 1))
        AND  /* field equal to URI ref */
        "s_1_7_t3"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/secondname' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t5"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_legal_entity' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t6"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_organization' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t7"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t8"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t9"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/pr' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t10"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/name' , 1))
        AND  /* field equal to URI ref */
        "s_1_22_t11"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/secondname' , 1))
OPTION (QUIETCAST)
      ) AS /* subq end */ "s_1_23"
  WHERE /* value of equiv class, fixed by replaced filter */
   ( /* retval[ */ "s_1_23"."g" /* g */ /* ]retval */ =  __i2idn ( /* UNAME as sqlval */ __bft ( 'http://egrul.ru/' , 1)))
    AND  /* value of equiv class, fixed by replaced filter */
   ( /* retval[ */ "s_1_23"."a" /* a */ /* ]retval */ =  __i2idn ( /* UNAME as sqlval */ __bft ( 'http://egrul-name.ru/' , 1)))
    AND  /* filter */
   ( /* retval[ */ "s_1_23"."legal_entity_owners" /* legal_entity_owners */ /* ]retval */ <>  /* retval[ */ "s_1_23"."companys_owners" /* companys_owners */ /* ]retval */)
OPTION (QUIETCAST)) AS "s_1_24_rbc"

Explain from isql-v:

  { 
    Subquery 27 
      { 
        RDF_QUAD_POGS   2.6e+07 rows(t3.O$34, t3.G$33, t3.S$32)
         inlined  P =  IRI_ID"...own_who" 
        RDF_QUAD         1 rows(t7.S$39, t7.G$38, t7.O$37)
         inlined  P =  IRI_ID"...secondname"  ,  S = cast$150 G =  IRI_ID"..." 
        RDF_QUAD         1 rows(t6.S$43, t6.O$42)
         inlined  P =  IRI_ID"...name"  ,  S = k_t3.O$162 G = t7.G$38
        RDF_QUAD         1 rows(t5.S$47, t5.O$46)
         inlined  P =  IRI_ID"...pr"  ,  S = k_t3.O$173
        RDF_QUAD_POGS        24 rows(t14.S$50)
         P =  IRI_ID"...secondname"  ,  O = k_t7.O$184
        RDF_QUAD   5.5e-07 rows(t13.S$53)
         inlined  P =  IRI_ID"...name"  ,  S = t14.S$50 ,  O = k_t6.O$194
        RDF_QUAD         1 rows(t12.S$57, t12.O$56)
         inlined  P =  IRI_ID"...pr"  ,  S = t13.S$53
        Precode:
          0: __all_eq$59 := Call __all_eq (t3.G$33,  IRI_ID"..." )
          5: BReturn 0
        RDF_QUAD_POGS       1.7 rows(t10.O$63, t10.S$62)
         P =  IRI_ID"...own_who"  ,  O = cast$211
        END Node
        After test:
        0: if (t5.S$47 = t10.O$63) then 5 else 4 unkn 5
        4: BReturn 1
        5: BReturn 0
        RDF_QUAD         1 rows(t4.O$66)
         inlined  P =  IRI_ID"...own_what"  ,  S = k_t3.S$227 G = k___all_eq$231
        RDF_QUAD_POGS       6.1 rows(t8.S$69)
         P =  IRI_ID"...aff_legal_entity"  ,  O = cast$239
        RDF_QUAD         1 rows(t9.O$72)
         inlined  P =  IRI_ID"...aff_organization"  ,  S = t8.S$69
        RDF_QUAD_POGS   5.9e-08 rows()
         inlined  P =  IRI_ID"...own_what"  ,  O = cast$255 ,  S = k_t10.S$259
        
        After code:
        0: __ro2sq$78 := Call __ro2sq (t5.O$46)
        5: _cvt$80 := Call _cvt (<tag 193 flag 0>, __ro2sq$78)
        10: __ro2sq$82 := Call __ro2sq (t12.O$56)
        15: _cvt$84 := Call _cvt (<tag 193 flag 0>, __ro2sq$82)
        20: lt$86 := Call lt (_cvt$80, _cvt$84)
        25: if ( 0  = lt$86) then 34 else 29 unkn 34
        29: callretSearchedCASE$76 :=  := artm t5.S$47
        33: Jump 38 (level=0)
        34: callretSearchedCASE$76 :=  := artm t10.O$63
        38: __ro2sq$90 := Call __ro2sq (t12.O$56)
        43: _cvt$92 := Call _cvt (<tag 193 flag 0>, __ro2sq$90)
        48: __ro2sq$94 := Call __ro2sq (t5.O$46)
        53: _cvt$96 := Call _cvt (<tag 193 flag 0>, __ro2sq$94)
        58: lte$98 := Call lte (_cvt$92, _cvt$96)
        63: if ( 0  = lte$98) then 72 else 67 unkn 72
        67: callretSearchedCASE$88 :=  := artm t5.S$47
        71: Jump 76 (level=0)
        72: callretSearchedCASE$88 :=  := artm t10.O$63
        76: BReturn 0
        Distinct (callretSearchedCASE$88, callretSearchedCASE$76)
        skip node  1  <none> set_no$30
        
        After code:
        0: toUri$28 :=  := artm callretSearchedCASE$88
        4: fromUri$29 :=  := artm callretSearchedCASE$76
        8: BReturn 0
        Subquery Select(toUri$28, fromUri$29)
      }
    
    After code:
    0: toUri$116 := Call __ro2sq (toUri$28)
    5: fromUri$118 := Call __ro2sq (fromUri$29)
    10: BReturn 0
    Select (toUri$116, fromUri$118)
  }

72 Rows. -- 126 msec.

Also I have the case (same db, same config):

the query:

PREFIX crm2: <http://sp7.ru/ontology/>PREFIX xsd:<http://www.w3.org/2001/XMLSchema#>
PREFIX owl:<http://www.w3.org/2002/07/owl#>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:<http://www.w3.org/2000/01/rdf-schema#>
PREFIX crm2:<http://sp7.ru/ontology/>
PREFIX sysont:<http://ns.ontowiki.net/SysOnt/>
PREFIX owconf:<http://localhost/OntoWiki/Config/>
PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
SELECT DISTINCT ?gridRelatedUri ?object ?objectSectorWhat ?ownWhat ?ownWhatOwnWho ?ownWhatPercent ?_ownWhatOwnWho ?ownWhatOwnWhoMainImage ?ownWhatOwnWhoMainImageThumbnail ?_ownWhatOwnWhoMainImageThumbnail ?ownWhatOwnWhoOwnWhoOwnWhat ?ownWhatOwnWhoOwnWhoOwnWhatLabel ?conditionSUM ?ownWhatOwnWhoMainImageLink ?_ownWhatOwnWhoMainImageLink ?ownWhatOwnWhoOwnWho ?ownWhatOwnWho_slug ?ownWhatOwnWhoOwnWhoOwnWhat_slug
WHERE { ?object <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?sparql_type_50
	.?sparql_type_50 <http://sp7.ru/ontology/subClassOfCache> <http://sp7.ru/ontology/SectorWearing>  .
	?objectSectorWhat <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?sparql_type_72
	.?sparql_type_72 <http://sp7.ru/ontology/subClassOfCache> <http://sp7.ru/ontology/Organization>  .
	?ownWhat <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?sparql_type_93
	.?sparql_type_93 <http://sp7.ru/ontology/subClassOfCache> <http://sp7.ru/ontology/Ownership>  .
	?ownWhatOwnWho <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ?sparql_type_106
	.?sparql_type_106 <http://sp7.ru/ontology/subClassOfCache> <http://sp7.ru/ontology/Agent>  .
	?aff <http://sp7.ru/ontology/aff_legal_entity> ?le .
	?aff <http://sp7.ru/ontology/aff_organization> ?objectSectorWhat .
	?object <http://sp7.ru/ontology/object> ?gridRelatedUri .
	?objectSectorWhat <http://sp7.ru/ontology/sectorWhat> ?object .
	?ownWhat <http://sp7.ru/ontology/own_what> ?le .
	?ownWhat <http://sp7.ru/ontology/own_who> ?ownWhatOwnWho .
	?ownWhatOwnWhoOwnWho <http://sp7.ru/ontology/own_what> ?ownWhatOwnWhoOwnWhoOwnWhat .
	?ownWhatOwnWhoOwnWho <http://sp7.ru/ontology/own_who> ?ownWhatOwnWho
	OPTIONAL {
		?ownWhatOwnWho 	<http://sp7.ru/ontology/slug> ?ownWhatOwnWho_slug
	}
	OPTIONAL {
		?ownWhatOwnWhoOwnWhoOwnWhat 	<http://sp7.ru/ontology/slug> ?ownWhatOwnWhoOwnWhoOwnWhat_slug
	}
	OPTIONAL {
		?ownWhatOwnWho 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoru
		FILTER (LANG(?_ownWhatOwnWhoru) = "ru")
	}
	OPTIONAL {
		?ownWhatOwnWho 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoall
		FILTER (LANG(?_ownWhatOwnWhoall) = "all")
	}
	OPTIONAL {
		?ownWhatOwnWho <http://sp7.ru/ontology/mainImage> ?ownWhatOwnWhoMainImage
		OPTIONAL {
			?ownWhatOwnWhoMainImage <http://sp7.ru/ontology/thumbnail> ?ownWhatOwnWhoMainImageThumbnail
			OPTIONAL {
				?ownWhatOwnWhoMainImageThumbnail 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoMainImageThumbnailru
				FILTER (LANG(?_ownWhatOwnWhoMainImageThumbnailru) = "ru")
			}
			OPTIONAL {
				?ownWhatOwnWhoMainImageThumbnail 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoMainImageThumbnailall
				FILTER (LANG(?_ownWhatOwnWhoMainImageThumbnailall) = "all")
			}
			BIND(IF(BOUND(?_ownWhatOwnWhoMainImageThumbnailru), ?_ownWhatOwnWhoMainImageThumbnailru, ?_ownWhatOwnWhoMainImageThumbnailall) AS ?_ownWhatOwnWhoMainImageThumbnail)
		}
		OPTIONAL {
			?ownWhatOwnWhoMainImage <http://sp7.ru/ontology/link> ?ownWhatOwnWhoMainImageLink
			OPTIONAL {
				?ownWhatOwnWhoMainImageLink 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoMainImageLinkru
				FILTER (LANG(?_ownWhatOwnWhoMainImageLinkru) = "ru")
			}
			OPTIONAL {
				?ownWhatOwnWhoMainImageLink 	<http://www.w3.org/2000/01/rdf-schema#label> ?_ownWhatOwnWhoMainImageLinkall
				FILTER (LANG(?_ownWhatOwnWhoMainImageLinkall) = "all")
			}
			BIND(IF(BOUND(?_ownWhatOwnWhoMainImageLinkru), ?_ownWhatOwnWhoMainImageLinkru, ?_ownWhatOwnWhoMainImageLinkall) AS ?_ownWhatOwnWhoMainImageLink)
		}
	}
	OPTIONAL {
		?ownWhatOwnWhoOwnWhoOwnWhat 	<http://www.w3.org/2000/01/rdf-schema#label> ?ownWhatOwnWhoOwnWhoOwnWhatLabelru
		FILTER (LANG(?ownWhatOwnWhoOwnWhoOwnWhatLabelru) = "ru")
	}
	OPTIONAL {
		?ownWhatOwnWhoOwnWhoOwnWhat 	<http://www.w3.org/2000/01/rdf-schema#label> ?ownWhatOwnWhoOwnWhoOwnWhatLabelall
		FILTER (LANG(?ownWhatOwnWhoOwnWhoOwnWhatLabelall) = "all")
	}
	OPTIONAL {
		?ownWhat <http://sp7.ru/ontology/percent> ?ownWhatPercent
	}
	BIND(xsd:float(replace(replace(?ownWhatPercent, "%", ""), ",", "." )) as ?clearPersent)
	{
		SELECT ?ownWhatOwnWho SUM(distinct xsd:integer(?condition)) as ?conditionSUM WHERE {
			?ownWhatOwnWhoOwnWho crm2:own_who ?ownWhatOwnWho.
			?ownWhatOwnWhoOwnWho crm2:own_what ?ownWhatOwnWhoOwnWhoOwnWhat.
			?ownWhatOwnWhoOwnWho crm2:percent ?ownWhoPercent.
			?index  rdf:type crm2:Index.
			?index crm2:about ?ownWhatOwnWhoOwnWhoOwnWhat.
			?index crm2:value ?indexValueN.
			?index crm2:type crm2:fin_revenue.
			?index crm2:source crm2:fin_import_nalog_2018.
			BIND((xsd:integer(?indexValueN)*xsd:integer(?ownWhoPercent)/100/10*4) AS ?condition)
		}
	}
	FILTER (?gridRelatedUri = <http://sp7.ru/ontology/res3_4137888>)
	FILTER (?ownWhatOwnWho = <http://sp7.ru/ontology/eile_regNumber_ne158758_kipr> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_regNumber_he158758_kipr> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_regNumber_366982_kipr> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_regNumber_ne344862_kipr> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_1047796985554_rus> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_1067760471822_rus> || ?ownWhatOwnWho = <http://sp7.ru/ontology/res_200985> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_regNumber_he315359_kipr> || ?ownWhatOwnWho = <http://sp7.ru/ontology/res_85971> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_1187746878770_rus> || ?ownWhatOwnWho = <http://sp7.ru/ontology/eile_1097847055855_rus> || ?ownWhatOwnWho = <http://sp7.ru/ontology/ei_human_772348766722>)
	BIND(IF(BOUND(?ownWhatOwnWhoOwnWhoOwnWhatLabelru), ?ownWhatOwnWhoOwnWhoOwnWhatLabelru, ?ownWhatOwnWhoOwnWhoOwnWhatLabelall) AS ?ownWhatOwnWhoOwnWhoOwnWhatLabel)
	BIND(IF(BOUND(?_ownWhatOwnWhoru), ?_ownWhatOwnWhoru, ?_ownWhatOwnWhoall) AS ?_ownWhatOwnWho)
	
} ORDER BY DESC(?conditionSUM)

returns everything ok on sparql endpoint.
Also it returns good results in isql-v. But, when I add define output:format "JSON" in the start of the query, ORDER BY doesn’t function anymore. The results come unsorted in ISQL-v (sparql enpoint works good even for JSON result format)

DEBUG INFO FROM SPARQL ENDPOINT:

https://pastebin.com/BawskdDM

SPARQL TRANSLATE from isql-v:

SELECT DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON (vector ( "s_1_113"."gridRelatedUri", "s_1_113"."object", "s_1_113"."objectSectorWhat", "s_1_113"."ownWhat", "s_1_113"."ownWhatOwnWho", "s_1_113"."ownWhatPercent", "s_1_113"."_ownWhatOwnWho", "s_1_113"."ownWhatOwnWhoMainImage", "s_1_113"."ownWhatOwnWhoMainImageThumbnail", "s_1_113"."_ownWhatOwnWhoMainImageThumbnail", "s_1_113"."ownWhatOwnWhoOwnWhoOwnWhat", "s_1_113"."ownWhatOwnWhoOwnWhoOwnWhatLabel", "s_1_113"."conditionSUM", "s_1_113"."ownWhatOwnWhoMainImageLink", "s_1_113"."_ownWhatOwnWhoMainImageLink", "s_1_113"."ownWhatOwnWhoOwnWho", "s_1_113"."ownWhatOwnWho_slug", "s_1_113"."ownWhatOwnWhoOwnWhoOwnWhat_slug"), vector (  'gridRelatedUri' ,  'object' ,  'objectSectorWhat' ,  'ownWhat' ,  'ownWhatOwnWho' ,  'ownWhatPercent' ,  '_ownWhatOwnWho' ,  'ownWhatOwnWhoMainImage' ,  'ownWhatOwnWhoMainImageThumbnail' ,  '_ownWhatOwnWhoMainImageThumbnail' ,  'ownWhatOwnWhoOwnWhoOwnWhat' ,  'ownWhatOwnWhoOwnWhoOwnWhatLabel' ,  'conditionSUM' ,  'ownWhatOwnWhoMainImageLink' ,  '_ownWhatOwnWhoMainImageLink' ,  'ownWhatOwnWhoOwnWho' ,  'ownWhatOwnWho_slug' ,  'ownWhatOwnWhoOwnWhoOwnWhat_slug' )) AS "callret-0" LONG VARCHAR
FROM (
  SELECT DISTINCT __i2id ( UNAME'http://sp7.ru/ontology/res3_4137888' ) AS /* scalar */ "gridRelatedUri",
    /* retval[ */ "s_1_112"."object" /* object */ /* ]retval */ AS /* retval */ "object",
    /* retval[ */ "s_1_112"."objectSectorWhat" /* objectSectorWhat */ /* ]retval */ AS /* retval */ "objectSectorWhat",
    /* retval[ */ "s_1_112"."ownWhat" /* ownWhat */ /* ]retval */ AS /* retval */ "ownWhat",
    /* retval[ */ "s_1_112"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatPercent" /* ownWhatPercent */ /* ]retval */) AS /* tmpl */ "ownWhatPercent",
    __ro2lo ( /* retval[ */ "s_1_112"."_ownWhatOwnWho" /* _ownWhatOwnWho */ /* ]retval */) AS /* tmpl */ "_ownWhatOwnWho",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoMainImage",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoMainImageThumbnail",
    __ro2lo ( /* retval[ */ "s_1_112"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */) AS /* tmpl */ "_ownWhatOwnWhoMainImageThumbnail",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoOwnWhoOwnWhat" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoOwnWhoOwnWhat",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoOwnWhoOwnWhatLabel" /* ownWhatOwnWhoOwnWhoOwnWhatLabel */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoOwnWhoOwnWhatLabel",
     MAX (
       /* retval[ */ "s_1_112"."conditionSUM" /* conditionSUM */ /* ]retval */) AS /* retsimple */ "conditionSUM",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoMainImageLink",
    __ro2lo ( /* retval[ */ "s_1_112"."_ownWhatOwnWhoMainImageLink" /* _ownWhatOwnWhoMainImageLink */ /* ]retval */) AS /* tmpl */ "_ownWhatOwnWhoMainImageLink",
    /* retval[ */ "s_1_112"."ownWhatOwnWhoOwnWho" /* ownWhatOwnWhoOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWho",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWho_slug" /* ownWhatOwnWho_slug */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWho_slug",
    __ro2lo ( /* retval[ */ "s_1_112"."ownWhatOwnWhoOwnWhoOwnWhat_slug" /* ownWhatOwnWhoOwnWhoOwnWhat_slug */ /* ]retval */) AS /* tmpl */ "ownWhatOwnWhoOwnWhoOwnWhat_slug"
  FROM ( /* subq begin */
     SELECT /* retval[ */ "s_1_90"."object" /* object */ /* ]retval */ AS /* retval */ "object",
        /* retval[ */ "s_1_90"."sparql_type_50" /* sparql_type_50 */ /* ]retval */ AS /* retval */ "sparql_type_50",
        /* retval[ */ "s_1_90"."objectSectorWhat" /* objectSectorWhat */ /* ]retval */ AS /* retval */ "objectSectorWhat",
        /* retval[ */ "s_1_90"."sparql_type_72" /* sparql_type_72 */ /* ]retval */ AS /* retval */ "sparql_type_72",
        /* retval[ */ "s_1_90"."ownWhat" /* ownWhat */ /* ]retval */ AS /* retval */ "ownWhat",
        /* retval[ */ "s_1_90"."sparql_type_93" /* sparql_type_93 */ /* ]retval */ AS /* retval */ "sparql_type_93",
        /* retval[ */ "s_1_90"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
        /* retval[ */ "s_1_90"."sparql_type_106" /* sparql_type_106 */ /* ]retval */ AS /* retval */ "sparql_type_106",
        /* retval[ */ "s_1_90"."aff" /* aff */ /* ]retval */ AS /* retval */ "aff",
        /* retval[ */ "s_1_90"."le" /* le */ /* ]retval */ AS /* retval */ "le",
        /* retval[ */ "s_1_90"."gridRelatedUri" /* gridRelatedUri */ /* ]retval */ AS /* retval */ "gridRelatedUri",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWho" /* ownWhatOwnWhoOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWho",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhat" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
        /* retval[ */ "s_1_90"."ownWhatOwnWho_slug" /* ownWhatOwnWho_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWho_slug",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhat_slug" /* ownWhatOwnWhoOwnWhoOwnWhat_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat_slug",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoru" /* _ownWhatOwnWhoru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoru",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoall" /* _ownWhatOwnWhoall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoall",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnail",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall",
        /* retval[ */ "s_1_90"."_ownWhatOwnWhoMainImageLink" /* _ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLink",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhatLabelru" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelru",
        /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhatLabelall" /* ownWhatOwnWhoOwnWhoOwnWhatLabelall */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelall",
        /* retval[ */ "s_1_90"."ownWhatPercent" /* ownWhatPercent */ /* ]retval */ AS /* retval */ "ownWhatPercent",
        /* retval[ */ "s_1_90"."clearPersent" /* clearPersent */ /* ]retval */ AS /* retval */ "clearPersent",
        /* retval[ */ "s_1_110"."conditionSUM" /* conditionSUM */ /* ]retval */ AS /* retval */ "conditionSUM",
        case when ((isnotnull ( /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhatLabelru" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */))) then ( /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhatLabelru" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */) else ( /* retval[ */ "s_1_90"."ownWhatOwnWhoOwnWhoOwnWhatLabelall" /* ownWhatOwnWhoOwnWhoOwnWhatLabelall */ /* ]retval */) end AS /* builtin */ "ownWhatOwnWhoOwnWhoOwnWhatLabel",
        case when ((isnotnull ( /* retval[ */ "s_1_90"."_ownWhatOwnWhoru" /* _ownWhatOwnWhoru */ /* ]retval */))) then ( /* retval[ */ "s_1_90"."_ownWhatOwnWhoru" /* _ownWhatOwnWhoru */ /* ]retval */) else ( /* retval[ */ "s_1_90"."_ownWhatOwnWhoall" /* _ownWhatOwnWhoall */ /* ]retval */) end AS /* builtin */ "_ownWhatOwnWho"
      FROM ( /* subq begin */
         SELECT /* retval[ */ "s_1_82_t44"."O" /* object */ /* ]retval */ AS /* retval */ "object",
            /* retval[ */ "s_1_82_t34"."S" /* sparql_type_50 */ /* ]retval */ AS /* retval */ "sparql_type_50",
            /* retval[ */ "s_1_82_t44"."S" /* objectSectorWhat */ /* ]retval */ AS /* retval */ "objectSectorWhat",
            /* retval[ */ "s_1_82_t36"."S" /* sparql_type_72 */ /* ]retval */ AS /* retval */ "sparql_type_72",
            /* retval[ */ "s_1_82_t46"."S" /* ownWhat */ /* ]retval */ AS /* retval */ "ownWhat",
            /* retval[ */ "s_1_82_t38"."S" /* sparql_type_93 */ /* ]retval */ AS /* retval */ "sparql_type_93",
            /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
            /* retval[ */ "s_1_82_t40"."S" /* sparql_type_106 */ /* ]retval */ AS /* retval */ "sparql_type_106",
            /* retval[ */ "s_1_82_t42"."S" /* aff */ /* ]retval */ AS /* retval */ "aff",
            /* retval[ */ "s_1_82_t45"."O" /* le */ /* ]retval */ AS /* retval */ "le",
            /* retval[ */ "s_1_82_t43"."O" /* gridRelatedUri */ /* ]retval */ AS /* retval */ "gridRelatedUri",
            /* retval[ */ "s_1_82_t48"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWho",
            /* retval[ */ "s_1_82_t47"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
            /* retval[ */ "s_1_34"."ownWhatOwnWho_slug" /* ownWhatOwnWho_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWho_slug",
            /* retval[ */ "s_1_37"."ownWhatOwnWhoOwnWhoOwnWhat_slug" /* ownWhatOwnWhoOwnWhoOwnWhat_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat_slug",
            /* retval[ */ "s_1_40"."_ownWhatOwnWhoru" /* _ownWhatOwnWhoru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoru",
            /* retval[ */ "s_1_43"."_ownWhatOwnWhoall" /* _ownWhatOwnWhoall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoall",
            /* retval[ */ "s_1_70"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
            /* retval[ */ "s_1_70"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnail",
            /* retval[ */ "s_1_70"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall",
            /* retval[ */ "s_1_70"."_ownWhatOwnWhoMainImageLink" /* _ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLink",
            /* retval[ */ "s_1_74"."ownWhatOwnWhoOwnWhoOwnWhatLabelru" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelru",
            /* retval[ */ "s_1_77"."ownWhatOwnWhoOwnWhoOwnWhatLabelall" /* ownWhatOwnWhoOwnWhoOwnWhatLabelall */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelall",
            /* retval[ */ "s_1_80"."ownWhatPercent" /* ownWhatPercent */ /* ]retval */ AS /* retval */ "ownWhatPercent",
             CAST ( __rdf_sqlval_of_obj /*l*/ ( DB.DBA.rdf_replace_impl ( DB.DBA.rdf_replace_impl ( __ro2lo ( /* retval[ */ "s_1_80"."ownWhatPercent" /* ownWhatPercent */ /* ]retval */),  '%' ,  '' ),  ',' ,  '.' )) AS  /* xqf parser simple retval */REAL) AS /* retsimple */ "clearPersent"
          FROM DB.DBA.RDF_QUAD AS "s_1_82_t33"
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t34"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t34"."S" /* sparql_type_50 */ /* ]retval */ = /* retval[ */ "s_1_82_t33"."O" /* sparql_type_50 */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t35"
            ON (1)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t36"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t36"."S" /* sparql_type_72 */ /* ]retval */ = /* retval[ */ "s_1_82_t35"."O" /* sparql_type_72 */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t37"
            ON (1)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t38"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t38"."S" /* sparql_type_93 */ /* ]retval */ = /* retval[ */ "s_1_82_t37"."O" /* sparql_type_93 */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t39"
            ON (1)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t40"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t40"."S" /* sparql_type_106 */ /* ]retval */ = /* retval[ */ "s_1_82_t39"."O" /* sparql_type_106 */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t41"
            ON (1)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t42"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t42"."O" /* objectSectorWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t35"."S" /* objectSectorWhat */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t42"."S" /* aff */ /* ]retval */ = /* retval[ */ "s_1_82_t41"."S" /* aff */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t43"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t43"."S" /* object */ /* ]retval */ = /* retval[ */ "s_1_82_t33"."S" /* object */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t44"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t44"."O" /* object */ /* ]retval */ = /* retval[ */ "s_1_82_t43"."S" /* object */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t44"."O" /* object */ /* ]retval */ = /* retval[ */ "s_1_82_t33"."S" /* object */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t44"."S" /* objectSectorWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t42"."O" /* objectSectorWhat */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t44"."S" /* objectSectorWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t35"."S" /* objectSectorWhat */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t45"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t45"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t37"."S" /* ownWhat */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t45"."O" /* le */ /* ]retval */ = /* retval[ */ "s_1_82_t41"."O" /* le */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t46"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t46"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t45"."S" /* ownWhat */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t46"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_82_t37"."S" /* ownWhat */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t47"
            ON (1)
            INNER JOIN DB.DBA.RDF_QUAD AS "s_1_82_t48"
            ON ( /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */
              AND  /* two fields belong to same equiv */
              /* retval[ */ "s_1_82_t48"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ = /* retval[ */ "s_1_82_t47"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_34_t0"."S" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                /* retval[ */ "s_1_34_t0"."O" /* ownWhatOwnWho_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWho_slug"
              FROM DB.DBA.RDF_QUAD AS "s_1_34_t0"
              WHERE /* field equal to URI ref */
                "s_1_34_t0"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/slug' , 1))) AS "s_1_34"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_34"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_34"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_34"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_37_t1"."S" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
                /* retval[ */ "s_1_37_t1"."O" /* ownWhatOwnWhoOwnWhoOwnWhat_slug */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat_slug"
              FROM DB.DBA.RDF_QUAD AS "s_1_37_t1"
              WHERE /* field equal to URI ref */
                "s_1_37_t1"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/slug' , 1))) AS "s_1_37"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t47"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ = /* retval[ */ "s_1_37"."ownWhatOwnWhoOwnWhoOwnWhat" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_40_t2"."S" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                /* retval[ */ "s_1_40_t2"."O" /* _ownWhatOwnWhoru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoru"
              FROM DB.DBA.RDF_QUAD AS "s_1_40_t2"
              WHERE /* field equal to URI ref */
                "s_1_40_t2"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                AND  /* filter */
               ( 'ru'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_40_t2"."O" /* _ownWhatOwnWhoru */ /* ]retval */)))) AS "s_1_40"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_40"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_40"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_40"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_43_t3"."S" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                /* retval[ */ "s_1_43_t3"."O" /* _ownWhatOwnWhoall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoall"
              FROM DB.DBA.RDF_QUAD AS "s_1_43_t3"
              WHERE /* field equal to URI ref */
                "s_1_43_t3"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                AND  /* filter */
               ( 'all'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_43_t3"."O" /* _ownWhatOwnWhoall */ /* ]retval */)))) AS "s_1_43"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_43"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_43"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_43"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_71"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
                /* retval[ */ "s_1_71"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                /* retval[ */ "s_1_71"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnail",
                /* retval[ */ "s_1_71"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
                /* retval[ */ "s_1_71"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
                /* retval[ */ "s_1_71"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
                /* retval[ */ "s_1_69"."_ownWhatOwnWhoMainImageLink" /* _ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLink",
                /* retval[ */ "s_1_69"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall",
                /* retval[ */ "s_1_69"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru",
                /* retval[ */ "s_1_69"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink"
              FROM (
                  SELECT /* retval[ */ "s_1_71_t13"."S" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                    /* retval[ */ "s_1_71_t13"."O" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
                    /* retval[ */ "s_1_57"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnail",
                    /* retval[ */ "s_1_57"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
                    /* retval[ */ "s_1_57"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
                    /* retval[ */ "s_1_57"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail"
                  FROM DB.DBA.RDF_QUAD AS "s_1_71_t13"
                    LEFT OUTER JOIN (
                      SELECT /* retval[ */ "s_1_56"."_ownWhatOwnWhoMainImageThumbnail" /* _ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnail",
                        /* retval[ */ "s_1_56"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
                        /* retval[ */ "s_1_56"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
                        /* retval[ */ "s_1_56"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
                        /* retval[ */ "s_1_56"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage"
                      FROM ( /* subq begin */
                         SELECT /* retval[ */ "s_1_55_t7"."S" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
                            /* retval[ */ "s_1_55_t7"."O" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
                            /* retval[ */ "s_1_50"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru",
                            /* retval[ */ "s_1_53"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall",
                            case when ((isnotnull ( /* retval[ */ "s_1_50"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */))) then ( /* retval[ */ "s_1_50"."_ownWhatOwnWhoMainImageThumbnailru" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */) else ( /* retval[ */ "s_1_53"."_ownWhatOwnWhoMainImageThumbnailall" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */) end AS /* builtin */ "_ownWhatOwnWhoMainImageThumbnail"
                          FROM DB.DBA.RDF_QUAD AS "s_1_55_t7"
                            LEFT OUTER JOIN (
                              SELECT /* retval[ */ "s_1_50_t4"."S" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
                               /* retval[ */ "s_1_50_t4"."O" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailru"
                              FROM DB.DBA.RDF_QUAD AS "s_1_50_t4"
                              WHERE /* field equal to URI ref */
                               "s_1_50_t4"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                              AND  /* filter */
                              ( 'ru'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_50_t4"."O" /* _ownWhatOwnWhoMainImageThumbnailru */ /* ]retval */)))) AS "s_1_50"
                            ON ( /* field and retval belong to same equiv */
                              /* retval[ */ "s_1_55_t7"."O" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ = /* retval[ */ "s_1_50"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */)
                            LEFT OUTER JOIN (
                              SELECT /* retval[ */ "s_1_53_t5"."S" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageThumbnail",
                               /* retval[ */ "s_1_53_t5"."O" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageThumbnailall"
                              FROM DB.DBA.RDF_QUAD AS "s_1_53_t5"
                              WHERE /* field equal to URI ref */
                               "s_1_53_t5"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                              AND  /* filter */
                              ( 'all'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_53_t5"."O" /* _ownWhatOwnWhoMainImageThumbnailall */ /* ]retval */)))) AS "s_1_53"
                            ON ( /* field and retval belong to same equiv */
                              /* retval[ */ "s_1_55_t7"."O" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */ = /* retval[ */ "s_1_53"."ownWhatOwnWhoMainImageThumbnail" /* ownWhatOwnWhoMainImageThumbnail */ /* ]retval */)
                          WHERE /* field equal to URI ref */
                            "s_1_55_t7"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/thumbnail' , 1))
OPTION (QUIETCAST)
                          ) AS /* subq end */ "s_1_56") AS "s_1_57"
                    ON ( /* field and retval belong to same equiv */
                      /* retval[ */ "s_1_71_t13"."O" /* ownWhatOwnWhoMainImage */ /* ]retval */ = /* retval[ */ "s_1_57"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */)
                  WHERE /* field equal to URI ref */
                    "s_1_71_t13"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/mainImage' , 1))) AS "s_1_71"
                LEFT OUTER JOIN (
                  SELECT /* retval[ */ "s_1_68"."_ownWhatOwnWhoMainImageLink" /* _ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLink",
                    /* retval[ */ "s_1_68"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall",
                    /* retval[ */ "s_1_68"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru",
                    /* retval[ */ "s_1_68"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
                    /* retval[ */ "s_1_68"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage"
                  FROM ( /* subq begin */
                     SELECT /* retval[ */ "s_1_67_t11"."S" /* ownWhatOwnWhoMainImage */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImage",
                        /* retval[ */ "s_1_67_t11"."O" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
                        /* retval[ */ "s_1_62"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru",
                        /* retval[ */ "s_1_65"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall",
                        case when ((isnotnull ( /* retval[ */ "s_1_62"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */))) then ( /* retval[ */ "s_1_62"."_ownWhatOwnWhoMainImageLinkru" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */) else ( /* retval[ */ "s_1_65"."_ownWhatOwnWhoMainImageLinkall" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */) end AS /* builtin */ "_ownWhatOwnWhoMainImageLink"
                      FROM DB.DBA.RDF_QUAD AS "s_1_67_t11"
                        LEFT OUTER JOIN (
                          SELECT /* retval[ */ "s_1_62_t8"."S" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
                            /* retval[ */ "s_1_62_t8"."O" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkru"
                          FROM DB.DBA.RDF_QUAD AS "s_1_62_t8"
                          WHERE /* field equal to URI ref */
                            "s_1_62_t8"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                            AND  /* filter */
                           ( 'ru'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_62_t8"."O" /* _ownWhatOwnWhoMainImageLinkru */ /* ]retval */)))) AS "s_1_62"
                        ON ( /* field and retval belong to same equiv */
                          /* retval[ */ "s_1_67_t11"."O" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ = /* retval[ */ "s_1_62"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */)
                        LEFT OUTER JOIN (
                          SELECT /* retval[ */ "s_1_65_t9"."S" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoMainImageLink",
                            /* retval[ */ "s_1_65_t9"."O" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */ AS /* retval */ "_ownWhatOwnWhoMainImageLinkall"
                          FROM DB.DBA.RDF_QUAD AS "s_1_65_t9"
                          WHERE /* field equal to URI ref */
                            "s_1_65_t9"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                            AND  /* filter */
                           ( 'all'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_65_t9"."O" /* _ownWhatOwnWhoMainImageLinkall */ /* ]retval */)))) AS "s_1_65"
                        ON ( /* field and retval belong to same equiv */
                          /* retval[ */ "s_1_67_t11"."O" /* ownWhatOwnWhoMainImageLink */ /* ]retval */ = /* retval[ */ "s_1_65"."ownWhatOwnWhoMainImageLink" /* ownWhatOwnWhoMainImageLink */ /* ]retval */)
                      WHERE /* field equal to URI ref */
                        "s_1_67_t11"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/link' , 1))
OPTION (QUIETCAST)
                      ) AS /* subq end */ "s_1_68") AS "s_1_69"
                ON ( /* two retvals belong to same equiv */
                  /* retval[ */ "s_1_71"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */ = /* retval[ */ "s_1_69"."ownWhatOwnWhoMainImage" /* ownWhatOwnWhoMainImage */ /* ]retval */)) AS "s_1_70"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t48"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_70"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t46"."O" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_70"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t39"."S" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_70"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_74_t14"."S" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
                /* retval[ */ "s_1_74_t14"."O" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelru"
              FROM DB.DBA.RDF_QUAD AS "s_1_74_t14"
              WHERE /* field equal to URI ref */
                "s_1_74_t14"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                AND  /* filter */
               ( 'ru'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_74_t14"."O" /* ownWhatOwnWhoOwnWhoOwnWhatLabelru */ /* ]retval */)))) AS "s_1_74"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t47"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ = /* retval[ */ "s_1_74"."ownWhatOwnWhoOwnWhoOwnWhat" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_77_t15"."S" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
                /* retval[ */ "s_1_77_t15"."O" /* ownWhatOwnWhoOwnWhoOwnWhatLabelall */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhatLabelall"
              FROM DB.DBA.RDF_QUAD AS "s_1_77_t15"
              WHERE /* field equal to URI ref */
                "s_1_77_t15"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/2000/01/rdf-schema#label' , 1))
                AND  /* filter */
               ( 'all'  =  DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq ( /* retval[ */ "s_1_77_t15"."O" /* ownWhatOwnWhoOwnWhoOwnWhatLabelall */ /* ]retval */)))) AS "s_1_77"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t47"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ = /* retval[ */ "s_1_77"."ownWhatOwnWhoOwnWhoOwnWhat" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */)
            LEFT OUTER JOIN (
              SELECT /* retval[ */ "s_1_80_t16"."S" /* ownWhat */ /* ]retval */ AS /* retval */ "ownWhat",
                /* retval[ */ "s_1_80_t16"."O" /* ownWhatPercent */ /* ]retval */ AS /* retval */ "ownWhatPercent"
              FROM DB.DBA.RDF_QUAD AS "s_1_80_t16"
              WHERE /* field equal to URI ref */
                "s_1_80_t16"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/percent' , 1))) AS "s_1_80"
            ON ( /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t46"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_80"."ownWhat" /* ownWhat */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t45"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_80"."ownWhat" /* ownWhat */ /* ]retval */
              AND  /* field and retval belong to same equiv */
              /* retval[ */ "s_1_82_t37"."S" /* ownWhat */ /* ]retval */ = /* retval[ */ "s_1_80"."ownWhat" /* ownWhat */ /* ]retval */)
          WHERE /* field equal to URI ref */
            "s_1_82_t33"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t34"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/subClassOfCache' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t34"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/SectorWearing' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t35"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t36"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/subClassOfCache' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t36"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/Organization' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t37"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t38"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/subClassOfCache' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t38"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/Ownership' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t39"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t40"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/subClassOfCache' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t40"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/Agent' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t41"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_legal_entity' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t42"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/aff_organization' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t43"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/object' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t44"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/sectorWhat' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t45"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t46"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t47"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
            AND  /* field equal to URI ref */
            "s_1_82_t48"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
OPTION (QUIETCAST)
          ) AS /* subq end */ "s_1_90"
        INNER JOIN ( /* subq begin */
         SELECT /* retval[ */ "s_1_108"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
             SUM ( DISTINCT
                CAST ( /* retval[ */ "s_1_108"."condition" /* condition */ /* ]retval */ AS  /* xqf parser simple retval */INTEGER)) AS /* retsimple */ "conditionSUM"
          FROM ( /* subq begin */
             SELECT /* retval[ */ "s_1_107_t49"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWho",
                /* retval[ */ "s_1_107_t49"."O" /* ownWhatOwnWho */ /* ]retval */ AS /* retval */ "ownWhatOwnWho",
                /* retval[ */ "s_1_107_t50"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ AS /* retval */ "ownWhatOwnWhoOwnWhoOwnWhat",
                /* retval[ */ "s_1_107_t51"."O" /* ownWhoPercent */ /* ]retval */ AS /* retval */ "ownWhoPercent",
                /* retval[ */ "s_1_107_t52"."S" /* index */ /* ]retval */ AS /* retval */ "index",
                /* retval[ */ "s_1_107_t54"."O" /* indexValueN */ /* ]retval */ AS /* retval */ "indexValueN",
                ( ( ( (  CAST ( __ro2sq ( /* retval[ */ "s_1_107_t54"."O" /* indexValueN */ /* ]retval */) AS  /* xqf parser simple retval */INTEGER) *   CAST ( __ro2sq ( /* retval[ */ "s_1_107_t51"."O" /* ownWhoPercent */ /* ]retval */) AS  /* xqf parser simple retval */INTEGER)) /  100) /  10) *  4) AS /* retsimple */ "condition"
              FROM DB.DBA.RDF_QUAD AS "s_1_107_t49"
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t50"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t49"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ = /* retval[ */ "s_1_107_t50"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t51"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t49"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ = /* retval[ */ "s_1_107_t51"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t50"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */ = /* retval[ */ "s_1_107_t51"."S" /* ownWhatOwnWhoOwnWho */ /* ]retval */)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t52"
                ON (1)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t53"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t50"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */ = /* retval[ */ "s_1_107_t53"."O" /* ownWhatOwnWhoOwnWhoOwnWhat */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t52"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t53"."S" /* index */ /* ]retval */)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t54"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t52"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t54"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t53"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t54"."S" /* index */ /* ]retval */)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t55"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t52"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t55"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t53"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t55"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t54"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t55"."S" /* index */ /* ]retval */)
                INNER JOIN DB.DBA.RDF_QUAD AS "s_1_107_t56"
                ON ( /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t52"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t56"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t53"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t56"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t54"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t56"."S" /* index */ /* ]retval */
                  AND  /* two fields belong to same equiv */
                  /* retval[ */ "s_1_107_t55"."S" /* index */ /* ]retval */ = /* retval[ */ "s_1_107_t56"."S" /* index */ /* ]retval */)
              WHERE /* field equal to URI ref */
                "s_1_107_t49"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_who' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t50"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/own_what' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t51"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/percent' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t52"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://www.w3.org/1999/02/22-rdf-syntax-ns#type' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t52"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/Index' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t53"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/about' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t54"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/value' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t55"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/type' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t55"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/fin_revenue' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t56"."P" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/source' , 1))
                AND  /* field equal to URI ref */
                "s_1_107_t56"."O" = __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/fin_import_nalog_2018' , 1))
OPTION (QUIETCAST)
              ) AS /* subq end */ "s_1_108"
          GROUP BY /* retval[ */ "s_1_108"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */
OPTION (QUIETCAST)
          ) AS /* subq end */ "s_1_110"
        ON ( /* two retvals belong to same equiv */
          /* retval[ */ "s_1_90"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ = /* retval[ */ "s_1_110"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */)
OPTION (QUIETCAST)
      ) AS /* subq end */ "s_1_112"
  WHERE /* value of equiv class, fixed by replaced filter */
   ( /* retval[ */ "s_1_112"."gridRelatedUri" /* gridRelatedUri */ /* ]retval */ =  __i2idn ( /* UNAME as sqlval */ __bft ( 'http://sp7.ru/ontology/res3_4137888' , 1)))
    AND  /* filter */
    ( /* retval[ */ "s_1_112"."ownWhatOwnWho" /* ownWhatOwnWho */ /* ]retval */ in ( __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_regNumber_ne158758_kipr' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_regNumber_he158758_kipr' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_regNumber_366982_kipr' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_regNumber_ne344862_kipr' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_1047796985554_rus' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_1067760471822_rus' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/res_200985' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_regNumber_he315359_kipr' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/res_85971' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_1187746878770_rus' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/eile_1097847055855_rus' , 1), 1)),  __i2idn ( __bft ( /* QName as sqlval */ __bft ( 'http://sp7.ru/ontology/ei_human_772348766722' , 1), 1))))
  ORDER BY /* retval[ */ "s_1_112"."conditionSUM" /* conditionSUM */ /* ]retval */ DESC
OPTION (QUIETCAST) ) AS "s_1_113"
OPTION (QUIETCAST)

Explain from isql-v:

 { 
    Precode:
      0: vector$27  := Call vector (<c gridRelatedUri>, <c object>, <c objectSectorWhat>, <c ownWhat>, <c ownWhatOwnWho>, <c ownWhatPercent>, <c _ownWhatOwnWho>, <c ownWhatOwnWhoMainImage>, <c ownWhatOwnWhoMainImageThumbnail>, <c _ownWhatOwnWhoMainImageThumbnail>, <c ownWhatOwnWhoOwnWhoOwnWhat>, <c ownWhatOwnWhoOwnWhoOwnWhatLabel>, <c conditionSUM>, <c ownWhatOwnWhoMainImageLink>, <c _ownWhatOwnWhoMainImageLink>, <c ownWhatOwnWhoOwnWho>, <c ownWhatOwnWho_slug>, <c ownWhatOwnWhoOwnWhoOwnWhat_slug>)
      5: BReturn 0
    fork {
        fork {
            RDF_QUAD_POGS   1.5e+02 rows(t141.S$50)
             P =  IRI_ID"...object"  ,  O =  IRI_ID"...res3_4137888" 
            RDF_QUAD       1.1 rows(t131.O$54, t131.S$53)
             inlined  P =  IRI_ID"...type"  ,  S = t141.S$50
            RDF_QUAD   0.00013 rows()
             inlined  P =  IRI_ID"...subClassOfCache"  ,  S = k_t131.O$566 ,  O =  IRI_ID"...SectorWearing" 
            RDF_QUAD_POGS       1.9 rows(t142.S$60, t142.O$59)
             P =  IRI_ID"...sectorWhat"  ,  O = k_t141.S$575
            RDF_QUAD       1.1 rows(t133.O$64, t133.S$63)
             inlined  P =  IRI_ID"...type"  ,  S = t142.S$60
            RDF_QUAD   0.00063 rows()
             inlined  P =  IRI_ID"...subClassOfCache"  ,  S = k_t133.O$593 ,  O =  IRI_ID"...Organization" 
            RDF_QUAD_POGS         1 rows(t140.S$69)
             P =  IRI_ID"...aff_organization"  ,  O = k_t133.S$602
            RDF_QUAD       1.1 rows(t139.O$72)
             inlined  P =  IRI_ID"...aff_legal_entity"  ,  S = t140.S$69
            RDF_QUAD_POGS        27 rows(t143.S$75)
             P =  IRI_ID"...own_what"  ,  O = cast$618
            RDF_QUAD       1.1 rows(t135.O$79, t135.S$78)
             inlined  P =  IRI_ID"...type"  ,  S = t143.S$75
            RDF_QUAD   0.00013 rows()
             inlined  P =  IRI_ID"...subClassOfCache"  ,  S = k_t135.O$635 ,  O =  IRI_ID"...Ownership" 
            RDF_QUAD         1 rows(t144.O$85, t144.S$84)
             inlined  P =  IRI_ID"...own_who"  ,  S = k_t143.S$644
            RDF_QUAD       1.1 rows(t137.O$89, t137.S$88)
             inlined  P =  IRI_ID"...type"  ,  S = k_t144.O$655
            RDF_QUAD   0.00088 rows()
             inlined  P =  IRI_ID"...subClassOfCache"  ,  S = k_t137.O$666 ,  O =  IRI_ID"...Agent" 
            RDF_QUAD_POGS       1.5 rows(t146.O$95, t146.S$94)
             P =  IRI_ID"...own_who"  ,  O = k_t144.O$675
            END Node
            After test:
            0: one_of_these$97 := Call one_of_these (t146.O$95,  IRI_ID"...eile_regNumber_ne158758_kipr" ,  IRI_ID"...eile_regNumber_he158758_kipr" ,  IRI_ID"...eile_regNumber_366982_kipr" ,  IRI_ID"...eile_regNumber_ne344862_kipr" ,  IRI_ID"...eile_1047796985554_rus" ,  IRI_ID"...eile_1067760471822_rus" ,  IRI_ID"...res_200985" ,  IRI_ID"...eile_regNumber_he315359_kipr" ,  IRI_ID"...res_85971" ,  IRI_ID"...eile_1187746878770_rus" ,  IRI_ID"...eile_1097847055855_rus" ,  IRI_ID"...ei_human_772348766722" )
            5: if ( 0  < one_of_these$97) then 9 else 10 unkn 10
            9: BReturn 1
            10: BReturn 0
            Subquery 99 
              { 
                fork {
                    RDF_QUAD_POGS       1.7 rows(t165.S$105, t165.O$104)
                     P =  IRI_ID"...own_who"  ,  O = k_t146.O$696
                    RDF_QUAD         1 rows(t166.S$109, t166.O$108)
                     inlined  P =  IRI_ID"...own_what"  ,  S = t165.S$105
                    RDF_QUAD         1 rows(t167.O$112)
                     inlined  P =  IRI_ID"...percent"  ,  S = k_t165.S$714
                    RDF_QUAD_POGS       8.8 rows(t169.S$115)
                     P =  IRI_ID"...about"  ,  O = k_t166.O$724
                    RDF_QUAD      0.04 rows(t172.S$118)
                     inlined  P =  IRI_ID"...source"  ,  S = t169.S$115 ,  O =  IRI_ID"...fin_import_nalog_2018" 
                    RDF_QUAD_POGS     0.045 rows(t171.S$121)
                     inlined  P =  IRI_ID"...type"  ,  O =  IRI_ID"...fin_revenue"  ,  S = k_t169.S$740
                    RDF_QUAD_POGS       0.8 rows(t168.S$124)
                     inlined  P =  IRI_ID"...type"  ,  O =  IRI_ID"...Index"  ,  S = k_t169.S$750
                    RDF_QUAD         1 rows(t170.O$127)
                     inlined  P =  IRI_ID"...value"  ,  S = t168.S$124
                    
                    After code:
                    0: __ro2sq$129 := Call __ro2sq (t167.O$112)
                    5: __ro2sq$131 := Call __ro2sq (t170.O$127)
                    10: _cvt$133 := Call _cvt (<tag 193 flag 0>, __ro2sq$131)
                    15: _cvt$135 := Call _cvt (<tag 193 flag 0>, __ro2sq$129)
                    20: temp$137 := artm _cvt$133 * _cvt$135
                    24: temp$139 := artm temp$137 /  100 
                    28: temp$141 := artm temp$139 /  10 
                    32: temp$143 := artm temp$141 *  4 
                    36: _cvt$145 := Call _cvt (<tag 193 flag 0>, temp$143)
                    41: BReturn 0
                    Sort (set_no$102, t165.O$104) -> (_cvt$145)
                    
                  }
                group by read node  
                (gb_set_no$161, t165.O$104, aggregate$149)
                
                After code:
                0: ownWhatOwnWho$100 :=  := artm t165.O$104
                4: conditionSUM$101 :=  := artm aggregate$149
                8: BReturn 0
                Subquery Select(ownWhatOwnWho$100, conditionSUM$101)
              }
            RDF_QUAD         1 rows(t145.O$180)
             inlined  P =  IRI_ID"...own_what"  ,  S = k_t146.S$786
            Precode:
              0: __all_eq$182 := Call __all_eq (t137.S$88, t146.O$95)
              5: BReturn 0
            outer {
                Subquery 184 
                  { 
                    RDF_QUAD         1 rows(t152.O$198, t152.S$197)
                     inlined  P =  IRI_ID"...mainImage"  ,  S = k___all_eq$805
                    outer {
                        Subquery 200 
                          { 
                            RDF_QUAD         1 rows(t158.O$209, t158.S$208)
                             inlined  P =  IRI_ID"...link"  ,  S = k_t152.O$825
                            outer {
                                RDF_QUAD         1 rows(t160.O$212)
                                 inlined  P =  IRI_ID"...label"  ,  S = k_t158.O$841
                                END Node
                                After test:
                                0: __ro2sq$214 := Call __ro2sq (t160.O$212)
                                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$216 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$214)
                                12: if (<c all> = DB.DBA.RDF_LANGUAGE_OF_OBJ$216) then 16 else 17 unkn 17
                                16: BReturn 1
                                17: BReturn 0
                              } /* end of outer */
                            set_ctr$219
                             out: (t160.O$212, __ro2sq$214, DB.DBA.RDF_LANGUAGE_OF_OBJ$216)
                             shadow: (t160.O$856,  <none> ,  <none> )
                            outer {
                                RDF_QUAD         1 rows(t159.O$229)
                                 inlined  P =  IRI_ID"...label"  ,  S = k_t158.O$867
                                END Node
                                After test:
                                0: __ro2sq$231 := Call __ro2sq (t159.O$229)
                                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$233 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$231)
                                12: if (<c ru> = DB.DBA.RDF_LANGUAGE_OF_OBJ$233) then 16 else 17 unkn 17
                                16: BReturn 1
                                17: BReturn 0
                              } /* end of outer */
                            set_ctr$236
                             out: (t159.O$229, __ro2sq$231, DB.DBA.RDF_LANGUAGE_OF_OBJ$233)
                             shadow: (t159.O$882,  <none> ,  <none> )
                            
                            After code:
                            0: isnotnull$247 := Call isnotnull (t159.O$882)
                            5: if ( 0  = isnotnull$247) then 14 else 9 unkn 14
                            9: callretSearchedCASE$245 :=  := artm t159.O$882
                            13: Jump 18 (level=0)
                            14: callretSearchedCASE$245 :=  := artm t160.O$212
                            18: _ownWhatOwnWhoMainImageLink$201 :=  := artm callretSearchedCASE$245
                            22: _ownWhatOwnWhoMainImageLinkall$202 :=  := artm t160.O$212
                            26: _ownWhatOwnWhoMainImageLinkru$203 :=  := artm t159.O$882
                            30: ownWhatOwnWhoMainImageLink$204 :=  := artm t158.O$209
                            34: ownWhatOwnWhoMainImage$205 :=  := artm t158.S$208
                            38: BReturn 0
                            Subquery Select(_ownWhatOwnWhoMainImageLink$201, _ownWhatOwnWhoMainImageLinkall$202, _ownWhatOwnWhoMainImageLinkru$203, ownWhatOwnWhoMainImageLink$204, ownWhatOwnWhoMainImage$205)
                          }
                      } /* end of outer */
                    set_ctr$257
                     out: (ownWhatOwnWhoMainImage$205, ownWhatOwnWhoMainImageLink$204, _ownWhatOwnWhoMainImageLinkall$202, set_no$206, _ownWhatOwnWhoMainImageLink$201, _ownWhatOwnWhoMainImageLinkru$203)
                     shadow: ( <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> )
                    outer {
                        Subquery 266 
                          { 
                            RDF_QUAD         1 rows(t154.O$275, t154.S$274)
                             inlined  P =  IRI_ID"...thumbnail"  ,  S = k_t152.O$910
                            outer {
                                RDF_QUAD         1 rows(t156.O$278)
                                 inlined  P =  IRI_ID"...label"  ,  S = k_t154.O$926
                                END Node
                                After test:
                                0: __ro2sq$280 := Call __ro2sq (t156.O$278)
                                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$282 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$280)
                                12: if (<c all> = DB.DBA.RDF_LANGUAGE_OF_OBJ$282) then 16 else 17 unkn 17
                                16: BReturn 1
                                17: BReturn 0
                              } /* end of outer */
                            set_ctr$285
                             out: (DB.DBA.RDF_LANGUAGE_OF_OBJ$282, t156.O$278, __ro2sq$280)
                             shadow: ( <none> , t156.O$941,  <none> )
                            outer {
                                RDF_QUAD         1 rows(t155.O$295)
                                 inlined  P =  IRI_ID"...label"  ,  S = k_t154.O$952
                                END Node
                                After test:
                                0: __ro2sq$297 := Call __ro2sq (t155.O$295)
                                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$299 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$297)
                                12: if (<c ru> = DB.DBA.RDF_LANGUAGE_OF_OBJ$299) then 16 else 17 unkn 17
                                16: BReturn 1
                                17: BReturn 0
                              } /* end of outer */
                            set_ctr$302
                             out: (DB.DBA.RDF_LANGUAGE_OF_OBJ$299, t155.O$295, __ro2sq$297)
                             shadow: ( <none> , t155.O$967,  <none> )
                            
                            After code:
                            0: isnotnull$313 := Call isnotnull (t155.O$967)
                            5: if ( 0  = isnotnull$313) then 14 else 9 unkn 14
                            9: callretSearchedCASE$311 :=  := artm t155.O$967
                            13: Jump 18 (level=0)
                            14: callretSearchedCASE$311 :=  := artm t156.O$278
                            18: _ownWhatOwnWhoMainImageThumbnail$267 :=  := artm callretSearchedCASE$311
                            22: _ownWhatOwnWhoMainImageThumbnailall$268 :=  := artm t156.O$278
                            26: _ownWhatOwnWhoMainImageThumbnailru$269 :=  := artm t155.O$967
                            30: ownWhatOwnWhoMainImageThumbnail$270 :=  := artm t154.O$275
                            34: ownWhatOwnWhoMainImage$271 :=  := artm t154.S$274
                            38: BReturn 0
                            Subquery Select(_ownWhatOwnWhoMainImageThumbnail$267, _ownWhatOwnWhoMainImageThumbnailall$268, _ownWhatOwnWhoMainImageThumbnailru$269, ownWhatOwnWhoMainImageThumbnail$270, ownWhatOwnWhoMainImage$271)
                          }
                      } /* end of outer */
                    set_ctr$323
                     out: (ownWhatOwnWhoMainImageThumbnail$270, ownWhatOwnWhoMainImage$271, set_no$272, _ownWhatOwnWhoMainImageThumbnailru$269, _ownWhatOwnWhoMainImageThumbnail$267, _ownWhatOwnWhoMainImageThumbnailall$268)
                     shadow: ( <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> )
                    
                    After code:
                    0: ownWhatOwnWhoMainImage$185 :=  := artm t152.O$198
                    4: ownWhatOwnWho$186 :=  := artm t152.S$197
                    8: _ownWhatOwnWhoMainImageThumbnail$187 :=  := artm _ownWhatOwnWhoMainImageThumbnail$267
                    12: _ownWhatOwnWhoMainImageThumbnailall$188 :=  := artm _ownWhatOwnWhoMainImageThumbnailall$268
                    16: _ownWhatOwnWhoMainImageThumbnailru$189 :=  := artm _ownWhatOwnWhoMainImageThumbnailru$269
                    20: ownWhatOwnWhoMainImageThumbnail$190 :=  := artm ownWhatOwnWhoMainImageThumbnail$270
                    24: _ownWhatOwnWhoMainImageLink$191 :=  := artm _ownWhatOwnWhoMainImageLink$201
                    28: _ownWhatOwnWhoMainImageLinkall$192 :=  := artm _ownWhatOwnWhoMainImageLinkall$202
                    32: _ownWhatOwnWhoMainImageLinkru$193 :=  := artm _ownWhatOwnWhoMainImageLinkru$203
                    36: ownWhatOwnWhoMainImageLink$194 :=  := artm ownWhatOwnWhoMainImageLink$204
                    40: BReturn 0
                    Subquery Select(ownWhatOwnWhoMainImage$185, ownWhatOwnWho$186, _ownWhatOwnWhoMainImageThumbnail$187, _ownWhatOwnWhoMainImageThumbnailall$188, _ownWhatOwnWhoMainImageThumbnailru$189, ownWhatOwnWhoMainImageThumbnail$190, _ownWhatOwnWhoMainImageLink$191, _ownWhatOwnWhoMainImageLinkall$192, _ownWhatOwnWhoMainImageLinkru$193, ownWhatOwnWhoMainImageLink$194)
                  }
              } /* end of outer */
            set_ctr$340
             out: (ownWhatOwnWhoMainImageLink$194, ownWhatOwnWhoMainImageThumbnail$190, _ownWhatOwnWhoMainImageLinkall$192, _ownWhatOwnWhoMainImageThumbnail$187, _ownWhatOwnWhoMainImageThumbnailall$188, set_no$195, ownWhatOwnWhoMainImage$185, ownWhatOwnWho$186, _ownWhatOwnWhoMainImageLinkru$193, _ownWhatOwnWhoMainImageLink$191, _ownWhatOwnWhoMainImageThumbnailru$189)
             shadow: ( <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> ,  <none> )
            outer {
                RDF_QUAD         1 rows(t162.O$350)
                 inlined  P =  IRI_ID"...label"  ,  S = k_t145.O$1008
                END Node
                After test:
                0: __ro2sq$352 := Call __ro2sq (t162.O$350)
                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$354 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$352)
                12: if (<c all> = DB.DBA.RDF_LANGUAGE_OF_OBJ$354) then 16 else 17 unkn 17
                16: BReturn 1
                17: BReturn 0
              } /* end of outer */
            set_ctr$357
             out: (t162.O$350, __ro2sq$352, DB.DBA.RDF_LANGUAGE_OF_OBJ$354)
             shadow: (t162.O$1023,  <none> ,  <none> )
            outer {
                RDF_QUAD         1 rows(t161.O$367)
                 inlined  P =  IRI_ID"...label"  ,  S = k_t145.O$1034
                END Node
                After test:
                0: __ro2sq$369 := Call __ro2sq (t161.O$367)
                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$371 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$369)
                12: if (<c ru> = DB.DBA.RDF_LANGUAGE_OF_OBJ$371) then 16 else 17 unkn 17
                16: BReturn 1
                17: BReturn 0
              } /* end of outer */
            set_ctr$374
             out: (t161.O$367, DB.DBA.RDF_LANGUAGE_OF_OBJ$371, __ro2sq$369)
             shadow: (t161.O$1049,  <none> ,  <none> )
            outer {
                RDF_QUAD         1 rows(t150.O$384)
                 inlined  P =  IRI_ID"...label"  ,  S = k_t146.O$1060
                END Node
                After test:
                0: __ro2sq$386 := Call __ro2sq (t150.O$384)
                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$388 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$386)
                12: if (<c all> = DB.DBA.RDF_LANGUAGE_OF_OBJ$388) then 16 else 17 unkn 17
                16: BReturn 1
                17: BReturn 0
              } /* end of outer */
            set_ctr$391
             out: (t150.O$384, __ro2sq$386, DB.DBA.RDF_LANGUAGE_OF_OBJ$388)
             shadow: (t150.O$1075,  <none> ,  <none> )
            outer {
                RDF_QUAD         1 rows(t149.O$401)
                 inlined  P =  IRI_ID"...label"  ,  S = k_t146.O$1086
                END Node
                After test:
                0: __ro2sq$403 := Call __ro2sq (t149.O$401)
                5: DB.DBA.RDF_LANGUAGE_OF_OBJ$405 := Call DB.DBA.RDF_LANGUAGE_OF_OBJ (__ro2sq$403)
                12: if (<c ru> = DB.DBA.RDF_LANGUAGE_OF_OBJ$405) then 16 else 17 unkn 17
                16: BReturn 1
                17: BReturn 0
              } /* end of outer */
            set_ctr$408
             out: (DB.DBA.RDF_LANGUAGE_OF_OBJ$405, __ro2sq$403, t149.O$401)
             shadow: ( <none> ,  <none> , t149.O$1101)
            outer {
                RDF_QUAD         1 rows(t163.O$418)
                 inlined  P =  IRI_ID"...percent"  ,  S = k_t144.S$1112
              } /* end of outer */
            set_ctr$421
             out: (t163.O$418)
             shadow: ( <none> )
            outer {
                RDF_QUAD         1 rows(t148.O$431)
                 inlined  P =  IRI_ID"...slug"  ,  S = k_t145.O$1131
              } /* end of outer */
            set_ctr$434
             out: (t148.O$431)
             shadow: ( <none> )
            outer {
                RDF_QUAD         1 rows(t147.O$444)
                 inlined  P =  IRI_ID"...slug"  ,  S = k_t146.O$1150
              } /* end of outer */
            set_ctr$447
             out: (t147.O$444)
             shadow: ( <none> )
            Precode:
              0: isnotnull$458 := Call isnotnull (t161.O$367)
              5: if ( 0  = isnotnull$458) then 14 else 9 unkn 14
              9: callretSearchedCASE$456 :=  := artm t161.O$367
              13: Jump 18 (level=0)
              14: callretSearchedCASE$456 :=  := artm t162.O$350
              18: isnotnull$462 := Call isnotnull (t149.O$401)
              23: if ( 0  = isnotnull$462) then 32 else 27 unkn 32
              27: callretSearchedCASE$460 :=  := artm t149.O$401
              31: Jump 36 (level=0)
              32: callretSearchedCASE$460 :=  := artm t150.O$384
              36: BReturn 0
            Sort (t142.O$59, t142.S$60, t144.S$84, t146.O$95, t163.O$418, callretSearchedCASE$460, ownWhatOwnWhoMainImage$185, ownWhatOwnWhoMainImageThumbnail$190, _ownWhatOwnWhoMainImageThumbnail$187, t145.O$180, callretSearchedCASE$456, ownWhatOwnWhoMainImageLink$194, _ownWhatOwnWhoMainImageLink$191, t146.S$94, t147.O$444, t148.O$431) -> (conditionSUM$101)
            
          }
        group by read node  
        (t142.O$59, t142.S$60, t144.S$84, t146.O$95, t163.O$418, callretSearchedCASE$460, ownWhatOwnWhoMainImage$185, ownWhatOwnWhoMainImageThumbnail$190, _ownWhatOwnWhoMainImageThumbnail$187, t145.O$180, callretSearchedCASE$456, ownWhatOwnWhoMainImageLink$194, _ownWhatOwnWhoMainImageLink$191, t146.S$94, t147.O$444, t148.O$431, aggregate$466)
        Precode:
          0: __ro2lo$484 := Call __ro2lo (t148.O$431)
          5: __ro2lo$486 := Call __ro2lo (t147.O$444)
          10: __ro2lo$488 := Call __ro2lo (_ownWhatOwnWhoMainImageLink$191)
          15: __ro2lo$490 := Call __ro2lo (ownWhatOwnWhoMainImageLink$194)
          20: __ro2lo$492 := Call __ro2lo (callretSearchedCASE$456)
          25: __ro2lo$494 := Call __ro2lo (t145.O$180)
          30: __ro2lo$496 := Call __ro2lo (_ownWhatOwnWhoMainImageThumbnail$187)
          35: __ro2lo$498 := Call __ro2lo (ownWhatOwnWhoMainImageThumbnail$190)
          40: __ro2lo$500 := Call __ro2lo (ownWhatOwnWhoMainImage$185)
          45: __ro2lo$502 := Call __ro2lo (callretSearchedCASE$460)
          50: __ro2lo$504 := Call __ro2lo (t163.O$418)
          55: BReturn 0
        Distinct (t142.O$59, t142.S$60, t144.S$84, t146.O$95, __ro2lo$504, __ro2lo$502, __ro2lo$500, __ro2lo$498, __ro2lo$496, __ro2lo$494, __ro2lo$492, aggregate$466, __ro2lo$490, __ro2lo$488, t146.S$94, __ro2lo$486, __ro2lo$484)
        
        After code:
        0: gridRelatedUri$30 :=  := artm  IRI_ID"...res3_4137888" 
        4: object$31 :=  := artm t142.O$59
        8: objectSectorWhat$32 :=  := artm t142.S$60
        12: ownWhat$33 :=  := artm t144.S$84
        16: ownWhatOwnWho$34 :=  := artm t146.O$95
        20: ownWhatPercent$35 :=  := artm __ro2lo$504
        24: _ownWhatOwnWho$36 :=  := artm __ro2lo$502
        28: ownWhatOwnWhoMainImage$37 :=  := artm __ro2lo$500
        32: ownWhatOwnWhoMainImageThumbnail$38 :=  := artm __ro2lo$498
        36: _ownWhatOwnWhoMainImageThumbnail$39 :=  := artm __ro2lo$496
        40: ownWhatOwnWhoOwnWhoOwnWhat$40 :=  := artm __ro2lo$494
        44: ownWhatOwnWhoOwnWhoOwnWhatLabel$41 :=  := artm __ro2lo$492
        48: conditionSUM$42 :=  := artm aggregate$466
        52: ownWhatOwnWhoMainImageLink$43 :=  := artm __ro2lo$490
        56: _ownWhatOwnWhoMainImageLink$44 :=  := artm __ro2lo$488
        60: ownWhatOwnWhoOwnWho$45 :=  := artm t146.S$94
        64: ownWhatOwnWho_slug$46 :=  := artm __ro2lo$486
        68: ownWhatOwnWhoOwnWhoOwnWhat_slug$47 :=  := artm __ro2lo$484
        72: BReturn 0
        Subquery Select(gridRelatedUri$30, object$31, objectSectorWhat$32, ownWhat$33, ownWhatOwnWho$34, ownWhatPercent$35, _ownWhatOwnWho$36, ownWhatOwnWhoMainImage$37, ownWhatOwnWhoMainImageThumbnail$38, _ownWhatOwnWhoMainImageThumbnail$39, ownWhatOwnWhoOwnWhoOwnWhat$40, ownWhatOwnWhoOwnWhoOwnWhatLabel$41, conditionSUM$42, ownWhatOwnWhoMainImageLink$43, _ownWhatOwnWhoMainImageLink$44, ownWhatOwnWhoOwnWho$45, ownWhatOwnWho_slug$46, ownWhatOwnWhoOwnWhoOwnWhat_slug$47)
        
        After code:
        0: vector$520 := Call vector (gridRelatedUri$30, object$31, objectSectorWhat$32, ownWhat$33, ownWhatOwnWho$34, ownWhatPercent$35, _ownWhatOwnWho$36, ownWhatOwnWhoMainImage$37, ownWhatOwnWhoMainImageThumbnail$38, _ownWhatOwnWhoMainImageThumbnail$39, ownWhatOwnWhoOwnWhoOwnWhat$40, ownWhatOwnWhoOwnWhoOwnWhatLabel$41, conditionSUM$42, ownWhatOwnWhoMainImageLink$43, _ownWhatOwnWhoMainImageLink$44, ownWhatOwnWhoOwnWho$45, ownWhatOwnWho_slug$46, ownWhatOwnWhoOwnWhoOwnWhat_slug$47)
        5: if (user_aggr_notfirst$525  =  1 ) then 20 else 9 unkn 9
        9: user_aggr_notfirst$525  :=  := artm  1 
        13: user_aggr_ret$527 := Call DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_INIT (user_aggr_env$526 )
        20: user_aggr_ret$527 := Call DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_ACC (user_aggr_env$526 , vector$520, vector$27 )
        27: BReturn 0
      }
    
    After code:
    0: callret-0$528 := Call DB.DBA.RDF_FORMAT_RESULT_SET_AS_JSON_FIN (user_aggr_env$526 )
    7: BReturn 0
    Select (callret-0$528)
  }

What is the Virtuoso version being used including the git id, please provide the output of running the command:

virtuoso-t -?

When connecting to the default ~/sparql endpoint queries are run as an internal SPARQL user, whereas via isql presume you are logging in as the dba user. Virtuoso also has a ~/sparql-auth endpoint that challenges for digest authentication, in which case it would be interesting to see if you connect to the ~/sparql-auth endpoint as the dba such that queries are executed as that user, do the queries behave the same as running via isql ?

– was included in the initial post –

Version 7.2.6-rc1.3230-pthreads as of Aug 9 2019 (e2a413e)

Yes, exactly. The queries in sparql-auth (dba user) behave the same as running via isql. Why SPARQL user has different behavior?

This is strange behaviour, as normally queries run as dba should give the best performance, which should at least be on a par with queries run via the /sparql endpoint as the special SPARQL user.

Do you have any graph groups (security) in place which might be controlling user access to graphs? Please provide the output of running the command:

SELECT id_to_iri (RGGM_GROUP_IID), id_to_iri(RGGM_MEMBER_IID) FROM DB.DBA.RDF_GRAPH_GROUP_MEMBER;

Also provide the triple count when run as the dba user with the query –

sparql select count(*) where {?s ?p ?o}

– and also the graph count with the command –

sparql select count(distinct ?g) where {GRAPH ?g{?s a ?t}}

All the commands should be run with the isql-v command line tool first, and then the last 2 queries for the triple and graph counts run from the default ~/sparql endpoint …

SQL> SELECT id_to_iri (RGGM_GROUP_IID), id_to_iri(RGGM_MEMBER_IID) FROM DB.DBA.RDF_GRAPH_GROUP_MEMBER;
Connected to OpenLink Virtuoso
Driver: 07.20.3230 OpenLink Virtuoso ODBC Driver
id_to_iri                                                                         id_to_iri__1
LONG VARCHAR                                                                      LONG VARCHAR
_______________________________________________________________________________

http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs                           urn:dav:home:dav:rdf_sink
http://www.openlinksw.com/schemas/virtrdf#PrivateGraphs                           urn:dav:home:dba:rdf_sink

2 Rows. -- 1 msec.

ISQL-V Triple count: 5 142 593 917
ISQL-V Graph count: 18
Sparql endpoint triple count: 5 142 594 179
Sparql endpoint graph count: 18

There is most probably a bad query plan being generated. To aid in diagnosis, can you please provide the query profile when run from isql with the SET PROFILE ON; command which provides query compilation and execution time information? Also please provide the query statistics by running the string_to_file('stat.dv', serialize(stat_export()), -2) command after the query has been executed.

Please also run the query from isql as the SPARQL user by running he command set_user_id('SPARQL') after logging in, and see if the execution time is then similar to when running from the /sparql endpoint …