Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

optional算子支持 #113

Open
jiguangxi opened this issue Jan 22, 2022 · 1 comment
Open

optional算子支持 #113

jiguangxi opened this issue Jan 22, 2022 · 1 comment

Comments

@jiguangxi
Copy link

jiguangxi commented Jan 22, 2022

您好,请问gStore支持OPTIONAL算子吗?对于下面查询,返回结果错误。变量?e, ?f ,?g, ?h对应的三元组模式直接被忽略?

========================SPARQL查询=====================
SELECT * WHERE {
?v0 http://schema.org/birthDate ?a .
OPTIONAL {
?v0 http://db.uwaterloo.ca/~galuc/wsdbm/userId ?b .
OPTIONAL { ?v0 http://xmlns.com/foaf/givenName ?c . }
OPTIONAL { ?v0 http://xmlns.com/foaf/familyName ?d . }
}
OPTIONAL{
?v0 http://db.uwaterloo.ca/~galuc/wsdbm/gender ?e .
}
OPTIONAL{
?v0 http://schema.org/email ?f .
}
OPTIONAL{
?v0 http://db.uwaterloo.ca/~galuc/wsdbm/friendOf ?g .
?v0 http://schema.org/telephone ?h .
}
}

=====================gStore解析=========================

...........................
query is:
SELECT  *       WHERE   {
?v0     <http://schema.org/birthDate>   ?a      .
OPTIONAL {
        ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/userId>    ?b      .
        OPTIONAL {      ?v0     <http://xmlns.com/foaf/givenName>       ?c      .       }
        OPTIONAL {      ?v0     <http://xmlns.com/foaf/familyName>      ?d      .       }
}
OPTIONAL{
        ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/gender>    ?e      .
}
OPTIONAL{
        ?v0     <http://schema.org/email>       ?f      .
}
OPTIONAL{
        ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/friendOf>  ?g      .
        ?v0     <http://schema.org/telephone>   ?h      .
}
}



206: WORKLOAD
        145: QUERY
                144: PROLOGUE
                155: SELECT
                        156: SELECT_CLAUSE
                                14: *
                        204: WHERE_CLAUSE
                                77: GROUP_GRAPH_PATTERN
                                        185: TRIPLES_SAME_SUBJECT
                                                177: SUBJECT
                                                        200: ?v0
                                                142: PREDICATE
                                                        129: PATH
                                                                132: PATH_SEQUENCE
                                                                        131: PATH_PRIMARY
                                                                                89: <http://schema.org/birthDate>
                                                119: OBJECT
                                                        200: ?a
                                        124: OPTIONAL
                                                77: GROUP_GRAPH_PATTERN
                                                        185: TRIPLES_SAME_SUBJECT
                                                                177: SUBJECT
                                                                        200: ?v0
                                                                142: PREDICATE
                                                                        129: PATH
                                                                                132: PATH_SEQUENCE
                                                                                        131: PATH_PRIMARY
                                                                                                89: <http://db.uwaterloo.ca/~galuc/wsdbm/userId>
                                                                119: OBJECT
                                                                        200: ?b
                                                        124: OPTIONAL
                                                                77: GROUP_GRAPH_PATTERN
                                                                        185: TRIPLES_SAME_SUBJECT
                                                                                177: SUBJECT
                                                                                        200: ?v0
                                                                                142: PREDICATE
                                                                                        129: PATH
                                                                                                132: PATH_SEQUENCE
                                                                                                        131: PATH_PRIMARY
                                                                                                                89: <http://xmlns.com/foaf/givenName>
                                                                                119: OBJECT
                                                                                        200: ?c
                                                        124: OPTIONAL
                                                                77: GROUP_GRAPH_PATTERN
                                                                        185: TRIPLES_SAME_SUBJECT
                                                                                177: SUBJECT
                                                                                        200: ?v0
                                                                                142: PREDICATE
                                                                                        129: PATH
                                                                                                132: PATH_SEQUENCE
                                                                                                        131: PATH_PRIMARY
                                                                                                                89: <http://xmlns.com/foaf/familyName>
                                                                                119: OBJECT
                                                                                        200: ?d
                                        124: OPTIONAL
                                                77: GROUP_GRAPH_PATTERN
                                                        185: TRIPLES_SAME_SUBJECT
                                                                177: SUBJECT
                                                                        200: ?v0
                                                                142: PREDICATE
                                                                        129: PATH
                                                                                132: PATH_SEQUENCE
                                                                                        131: PATH_PRIMARY
                                                                                                89: <http://db.uwaterloo.ca/~galuc/wsdbm/gender>
                                                                119: OBJECT
                                                                        200: ?e
                                        124: OPTIONAL
                                                77: GROUP_GRAPH_PATTERN
                                                        185: TRIPLES_SAME_SUBJECT
                                                                177: SUBJECT
                                                                        200: ?v0
                                                                142: PREDICATE
                                                                        129: PATH
                                                                                132: PATH_SEQUENCE
                                                                                        131: PATH_PRIMARY
                                                                                                89: <http://schema.org/email>
                                                                119: OBJECT
                                                                        200: ?f
                                        124: OPTIONAL
                                                77: GROUP_GRAPH_PATTERN
                                                        185: TRIPLES_SAME_SUBJECT
                                                                177: SUBJECT
                                                                        200: ?v0
                                                                142: PREDICATE
                                                                        129: PATH
                                                                                132: PATH_SEQUENCE
                                                                                        131: PATH_PRIMARY
                                                                                                89: <http://db.uwaterloo.ca/~galuc/wsdbm/friendOf>
                                                                119: OBJECT
                                                                        200: ?g
                                                        185: TRIPLES_SAME_SUBJECT
                                                                177: SUBJECT
                                                                        200: ?v0
                                                                142: PREDICATE
                                                                        129: PATH
                                                                                132: PATH_SEQUENCE
                                                                                        131: PATH_PRIMARY
                                                                                                89: <http://schema.org/telephone>
                                                                119: OBJECT
                                                                        200: ?h
.................................
================================================================================
SELECT
Var:    *
GroupPattern:
{
        ?v0     <http://schema.org/birthDate>   ?a.
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/userId>    ?b.
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/givenName>       ?c.
                }
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/familyName>      ?d.
                }
        }
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/gender>    ?e.
        }
        OPTIONAL
        {
                ?v0     <http://schema.org/email>       ?f.
        }
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/friendOf>  ?g.
                ?v0     <http://schema.org/telephone>   ?h.
        }
}
================================================================================
after Parsing, used 53ms.
read priviledge of update lock acquired
=================
||well-designed||
=================
================================================================================
{
        ?v0     <http://schema.org/birthDate>   ?a.
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/userId>    ?b.
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/givenName>       ?c.
                }
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/familyName>      ?d.
                }
        }
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/gender>    ?e.
        }
        OPTIONAL
        {
                ?v0     <http://schema.org/email>       ?f.
        }
        OPTIONAL
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/friendOf>  ?g.
                ?v0     <http://schema.org/telephone>   ?h.
        }
}
================================================================================
select vars: Varset: ?v0 ?a
triple patterns:
?v0     <http://schema.org/birthDate>   ?a
after checkCache, used 0 ms.
QueryCache miss
IN buildBasicSignature
now to check the query var list order:
0 ?v0
1 ?a
select variables: [?v0, 0 0]    [?a, 1 1]
graph variables: [?v0, 0 0]     [?a, 1 1]
before new IDList!
sub var id: 0
obj var id: 1
OUT encodeBasicQuery
after Encode, used 0 ms.
after FillCand, used 0 ms.
run the method:3
this BasicQuery use query strategy 3
after filter, used 0ms
after copy to result list: used 1 ms
Final result size: 2044
BasicQuery -- Final result size: 2044
after Handle, used 1 ms.
QueryCache didn't cache
after tryCache, used 0 ms.
================================================================================
        {
                ?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/userId>    ?b.
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/givenName>       ?c.
                }
                OPTIONAL
                {
                        ?v0     <http://xmlns.com/foaf/familyName>      ?d.
                }
        }
================================================================================
select vars: Varset: ?v0 ?b
triple patterns:
?v0     <http://db.uwaterloo.ca/~galuc/wsdbm/userId>    ?b
?v0     <http://schema.org/birthDate>   ?a
IN buildBasicSignature
now to check the query var list order:
0 ?v0
1 ?b
select variables: [?v0, 0 0]    [?b, 1 1]
graph variables: [?v0, 0 0]     [?b, 1 1]
before new IDList!
sub var id: 0
obj var id: 1
sub var id: 0
OUT encodeBasicQuery
after Encode, used 0 ms.
fill var ?v0 CandidateList size 2044
after FillCand, used 0 ms.
run the method:0
this BasicQuery use query strategy 0
after Retrieve, used 0ms.
start constant filter here

        Var0 ?v0
                [0] after constant filter, candidate size = 2044


        Var1 ?b
                [1] after constant filter, candidate size = 0


pre filter start here
        Var0 ?v0
skip the prefilter because the pre var is not efficent enough
skip the prefilter because the pre var is not efficent enough
after prehandler: used 5 ms
var 0 is ready!
var 1 is not ready!
use multi-join here!
after join_basic: used 0 ms
after only pre filter: used 1 ms
table size after pre_var 2044
after pre var: used 0 ms
after copy to result list: used 2 ms
Final result size: 2044
after Join, used 8ms.
BasicQuery -- Final result size: 2044
after Handle, used 8 ms.
================================================================================
                {
                        ?v0     <http://xmlns.com/foaf/givenName>       ?c.
                }
================================================================================
select vars: Varset: ?v0 ?c
triple patterns:
?v0     <http://xmlns.com/foaf/givenName>       ?c
?v0     <http://schema.org/birthDate>   ?a
IN buildBasicSignature
now to check the query var list order:
0 ?v0
1 ?c
select variables: [?v0, 0 0]    [?c, 1 1]
graph variables: [?v0, 0 0]     [?c, 1 1]
before new IDList!
sub var id: 0
obj var id: 1
sub var id: 0
OUT encodeBasicQuery
after Encode, used 0 ms.
fill var ?v0 CandidateList size 2044
after FillCand, used 1 ms.
run the method:0
this BasicQuery use query strategy 0
after Retrieve, used 0ms.
start constant filter here

        Var0 ?v0
                [0] after constant filter, candidate size = 2044


        Var1 ?c
                [1] after constant filter, candidate size = 0


pre filter start here
        Var0 ?v0
skip the prefilter because the pre var is not efficent enough
skip the prefilter because the pre var is not efficent enough
after prehandler: used 0 ms
var 0 is ready!
var 1 is not ready!
use multi-join here!
after join_basic: used 0 ms
after only pre filter: used 1 ms
table size after pre_var 2044
after pre var: used 0 ms
after copy to result list: used 1 ms
Final result size: 1451
after Join, used 2ms.
BasicQuery -- Final result size: 1451
after Handle, used 2 ms.
after doOptional, used 1 ms.
================================================================================
                {
                        ?v0     <http://xmlns.com/foaf/familyName>      ?d.
                }
================================================================================
select vars: Varset: ?v0 ?d
triple patterns:
?v0     <http://xmlns.com/foaf/familyName>      ?d
?v0     <http://schema.org/birthDate>   ?a
IN buildBasicSignature
now to check the query var list order:
0 ?v0
1 ?d
select variables: [?v0, 0 0]    [?d, 1 1]
graph variables: [?v0, 0 0]     [?d, 1 1]
before new IDList!
sub var id: 0
obj var id: 1
sub var id: 0
OUT encodeBasicQuery
after Encode, used 0 ms.
fill var ?v0 CandidateList size 2044
after FillCand, used 1 ms.
run the method:0
this BasicQuery use query strategy 0
after Retrieve, used 0ms.
start constant filter here

        Var0 ?v0
                [0] after constant filter, candidate size = 2044


        Var1 ?d
                [1] after constant filter, candidate size = 0


pre filter start here
        Var0 ?v0
skip the prefilter because the pre var is not efficent enough
skip the prefilter because the pre var is not efficent enough
after prehandler: used 0 ms
var 0 is ready!
var 1 is not ready!
use multi-join here!
after join_basic: used 0 ms
after only pre filter: used 0 ms
table size after pre_var 2044
after pre var: used 1 ms
after copy to result list: used 1 ms
Final result size: 1451
after Join, used 2ms.
BasicQuery -- Final result size: 1451
after Handle, used 2 ms.
after doOptional, used 1 ms.
after doOptional, used 1 ms.
after doProjection, used 0 ms.
in getFinal Result the first half use 1  ms
Entity StringIndex sequence access.
after get sort  used 0ms
after thread read used 1 ms
Literal StringIndex sequence access.
after get sort  used 0ms
after thread read used 0 ms
after getFinalResult, used 2ms.
Total time used: 73ms.
There has answer: 2044
final result is :
?v0     ?a      ?b      ?d      ?c
<http://db.uwaterloo.ca/~galuc/wsdbm/User1>     "1991-08-05"    "3597854"
<http://db.uwaterloo.ca/~galuc/wsdbm/User30>    "1982-09-10"    "5770863"
<http://db.uwaterloo.ca/~galuc/wsdbm/User33>    "1996-09-18"    "1843820"
<http://db.uwaterloo.ca/~galuc/wsdbm/User92>    "1974-08-09"    "1850290"
<http://db.uwaterloo.ca/~galuc/wsdbm/User95>    "1978-12-25"    "8661322"
@fyulingi
Copy link
Collaborator

您好,可否提供更多相关信息,如gStore版本。

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

No branches or pull requests

2 participants