how to create index on this xml data?

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

how to create index on this xml data?

lin_xd
hi,all,

  I have some file like this:

        <sourceid value="451134681"/>
        <id root="2.16.156.10011.1.35" extension="511226198010305000"/>
        <addr use="H">
            <item xsi:type="ST" nid="HDSD00.01.225" name="地址-门牌号码" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.226" name="现住地址-村(街、路、弄等)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.227" name="地址-乡(镇、街道办事处)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.228" name="地址-县(区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.229" name="地址-市(地区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.230" name="地址-省(自治区、直辖市)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.424" name="邮政编码" value=""/>
        </addr>
        <addr use="P">
            <item xsi:type="ST" nid="HDSD00.01.376" name="地址-门牌号码" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.377" name="现住地址-村(街、路、弄等)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.378" name="地址-乡(镇、街道办事处)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.379" name="地址-县(区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.380" name="地址-市(地区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.381" name="地址-省(自治区、直辖市)" value=""/>
        </addr>
        <item xsi:type="ST" nid="HDSD00.01.001" name="城乡居民健康档案编号" value="51072302082877341"/>
        <item xsi:type="ST" nid="HDSD00.01.397" name="传染病报告卡编号" value="4e753970-7d77-40b1-9610-cdb56732a2f6"/>
        <item xsi:type="ST" nid="HDSD00.01.002" name="本人姓名" value="孙静怡"/>
        <item xsi:type="CD" nid="HDSD00.01.003" name="性别代码" value="2"/><!-- codeSystem="2.16.156.10011.2.3.3.4" -->
        <item xsi:type="TS" nid="HDSD00.01.004" name="出生日期" value="19801030"/>
        <item xsi:type="CD" nid="HDSD00.01.407" name="传染病患者职业代码" value="07"/><!-- codeSystem="2.16.156.10011.2.3.1.6" -->
        <item xsi:type="CD" nid="HDSD00.01.005" name="身份证件类别代码" value="01"/><!-- codeSystem="2.16.156.10011.2.3.1.1" -->
        <item xsi:type="ST" nid="HDSD00.01.006" name="身份证件号码" value="511226198010305000"/>
        <item xsi:type="ST" nid="HDSD00.01.008" name="本人电话号码" value="138-1234-5678"/>
        <item xsi:type="ST" nid="HDSD00.01.374" name="家人电话号码" value="137-9536-4210"/>
        <item xsi:type="ST" nid="HDSD00.01.375" name="工作单位电话号码" value="08382600066"/>
        <item xsi:type="ST" nid="HDSD00.01.007" name="工作单位名称" value="单位"/>
        <guardian>
            <item xsi:type="ST" nid="HDSD00.01.372" name="监护人姓名" value="姓名>
            <item xsi:type="CD" nid="HDSD00.01.373" name="监护人与本人关系代码" value="51"/><!-- codeSystem="2.16.156.10011.2.3.3.8" -->
        </guardian>
    </patient>


I just want to create index on underline node, how ?

Thanks.


--
此致

easy

莫愁前路无知己,天下谁人不识君。


 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

Joe Wicentowski
Hi Xiaodong,

Let me express the structure underlined nodes in RelaxNG compact syntax:

element item {
  attribute xsi:type { text },
  attribute nid { text },
  attribute name { text },
  attribute value { text }
}
comment { text }

I assume you want to apply range indexes to speed queries like:

  //item[@xsi:type eq $some-value]
  //item[@nd eq $some-value]
  //item[@name eq $some-value]
  //item[@value eq $some-value]

... or some combination/variation of the above queries.  Is this correct?

If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:


eXist does not support indexes on the content of comment nodes.

Joe

On Tue, Jul 25, 2017 at 7:56 PM, 林晓东 <[hidden email]> wrote:
hi,all,

  I have some file like this:

        <sourceid value="451134681"/>
        <id root="2.16.156.10011.1.35" extension="511226198010305000"/>
        <addr use="H">
            <item xsi:type="ST" nid="HDSD00.01.225" name="地址-门牌号码" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.226" name="现住地址-村(街、路、弄等)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.227" name="地址-乡(镇、街道办事处)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.228" name="地址-县(区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.229" name="地址-市(地区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.230" name="地址-省(自治区、直辖市)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.424" name="邮政编码" value=""/>
        </addr>
        <addr use="P">
            <item xsi:type="ST" nid="HDSD00.01.376" name="地址-门牌号码" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.377" name="现住地址-村(街、路、弄等)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.378" name="地址-乡(镇、街道办事处)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.379" name="地址-县(区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.380" name="地址-市(地区)" value=""/>
            <item xsi:type="ST" nid="HDSD00.01.381" name="地址-省(自治区、直辖市)" value=""/>
        </addr>
        <item xsi:type="ST" nid="HDSD00.01.001" name="城乡居民健康档案编号" value="51072302082877341"/>
        <item xsi:type="ST" nid="HDSD00.01.397" name="传染病报告卡编号" value="4e753970-7d77-40b1-9610-cdb56732a2f6"/>
        <item xsi:type="ST" nid="HDSD00.01.002" name="本人姓名" value="孙静怡"/>
        <item xsi:type="CD" nid="HDSD00.01.003" name="性别代码" value="2"/><!-- codeSystem="2.16.156.10011.2.3.3.4" -->
        <item xsi:type="TS" nid="HDSD00.01.004" name="出生日期" value="19801030"/>
        <item xsi:type="CD" nid="HDSD00.01.407" name="传染病患者职业代码" value="07"/><!-- codeSystem="2.16.156.10011.2.3.1.6" -->
        <item xsi:type="CD" nid="HDSD00.01.005" name="身份证件类别代码" value="01"/><!-- codeSystem="2.16.156.10011.2.3.1.1" -->
        <item xsi:type="ST" nid="HDSD00.01.006" name="身份证件号码" value="511226198010305000"/>
        <item xsi:type="ST" nid="HDSD00.01.008" name="本人电话号码" value="138-1234-5678"/>
        <item xsi:type="ST" nid="HDSD00.01.374" name="家人电话号码" value="137-9536-4210"/>
        <item xsi:type="ST" nid="HDSD00.01.375" name="工作单位电话号码" value="08382600066"/>
        <item xsi:type="ST" nid="HDSD00.01.007" name="工作单位名称" value="单位"/>
        <guardian>
            <item xsi:type="ST" nid="HDSD00.01.372" name="监护人姓名" value="姓名>
            <item xsi:type="CD" nid="HDSD00.01.373" name="监护人与本人关系代码" value="51"/><!-- codeSystem="2.16.156.10011.2.3.3.8" -->
        </guardian>
    </patient>


I just want to create index on underline node, how ?

Thanks.


--
此致

easy

莫愁前路无知己,天下谁人不识君。


 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

Dannes Wessels-2
Hi,

> On 26 Jul 2017, at 03:44, Joe Wicentowski <[hidden email]> wrote:
>
>
> If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:

Looks like to index everything..... that might lead to huge indices and less performance I'd say. The tests will show.

Regards

Dannes
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

lin_xd
so ,how to ? <br/> the schema is bad?
At 2017-07-26 14:41:23, "Dannes Wessels" <[hidden email]> wrote:

>Hi,
>
>> On 26 Jul 2017, at 03:44, Joe Wicentowski <[hidden email]> wrote:
>>
>>
>> If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:
>
>Looks like to index everything..... that might lead to huge indices and less performance I'd say. The tests will show.
>
>Regards
>
>Dannes
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

Joe Wicentowski
You might want to look into "conditionally combined indexes" - a feature introduced recently:

  http://exist-db.org/exist/apps/doc/newrangeindex.xml#D2.2.4.5

If that doesn't do what you need, and if you only want to index *certain* elements of a given name or *certain* attributes but not others of the same name, then yes, you will need to adjust your schema to give those nodes unique names.  

But if you just want to do what you wrote in the subject line -- "to create index on this xml data" -- then you can do so without altering your schema.


On Thu, Jul 27, 2017 at 8:20 AM, 林晓东 <[hidden email]> wrote:
so ,how to ? <br/> the schema is bad?
At 2017-07-26 14:41:23, "Dannes Wessels" <[hidden email]> wrote:
>Hi,
>
>> On 26 Jul 2017, at 03:44, Joe Wicentowski <[hidden email]> wrote:
>>
>>
>> If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:
>
>Looks like to index everything..... that might lead to huge indices and less performance I'd say. The tests will show.
>
>Regards
>
>Dannes


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

lin_xd
Thanks.
--
此致

  easy.

莫愁前路无知己,天下谁人不识君。

在 2017-07-27 20:31:01,"Joe Wicentowski" <[hidden email]> 写道:
You might want to look into "conditionally combined indexes" - a feature introduced recently:

  http://exist-db.org/exist/apps/doc/newrangeindex.xml#D2.2.4.5

If that doesn't do what you need, and if you only want to index *certain* elements of a given name or *certain* attributes but not others of the same name, then yes, you will need to adjust your schema to give those nodes unique names.  

But if you just want to do what you wrote in the subject line -- "to create index on this xml data" -- then you can do so without altering your schema.


On Thu, Jul 27, 2017 at 8:20 AM, 林晓东 <[hidden email]> wrote:
so ,how to ? <br/> the schema is bad?
At 2017-07-26 14:41:23, "Dannes Wessels" <[hidden email]> wrote:
>Hi,
>
>> On 26 Jul 2017, at 03:44, Joe Wicentowski <[hidden email]> wrote:
>>
>>
>> If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:
>
>Looks like to index everything..... that might lead to huge indices and less performance I'd say. The tests will show.
>
>Regards
>
>Dannes



 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: how to create index on this xml data?

lin_xd
hi.all,
I can make this work:
 <create qname="scwst2:item" type="xs:string">
                 <condition    attribute="nid" value="HDSD00.01.001"/>
                <field name="nidval" match="@value" type="xs:string"/>
  </create>    
this will index all "item" node's value attribute with nid attribute "HDSD00.01.001".  but I want only index "item" node under "patient" node ,how ?

 


--
此致

 easy

莫愁前路无知己,天下谁人不识君。

在 2017-07-27 23:16:52,"林晓东" <[hidden email]> 写道:
Thanks.
--
此致

  easy.

莫愁前路无知己,天下谁人不识君。

在 2017-07-27 20:31:01,"Joe Wicentowski" <[hidden email]> 写道:
You might want to look into "conditionally combined indexes" - a feature introduced recently:

  http://exist-db.org/exist/apps/doc/newrangeindex.xml#D2.2.4.5

If that doesn't do what you need, and if you only want to index *certain* elements of a given name or *certain* attributes but not others of the same name, then yes, you will need to adjust your schema to give those nodes unique names.  

But if you just want to do what you wrote in the subject line -- "to create index on this xml data" -- then you can do so without altering your schema.


On Thu, Jul 27, 2017 at 8:20 AM, 林晓东 <[hidden email]> wrote:
so ,how to ? <br/> the schema is bad?
At 2017-07-26 14:41:23, "Dannes Wessels" <[hidden email]> wrote:
>Hi,
>
>> On 26 Jul 2017, at 03:44, Joe Wicentowski <[hidden email]> wrote:
>>
>>
>> If so, then you would create a range index of type xs:string on @xsi:type, @nd, @name, and @value - as described here:
>
>Looks like to index everything..... that might lead to huge indices and less performance I'd say. The tests will show.
>
>Regards
>
>Dannes



 




------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...