如何精确计算SPARQL CONSTRUCT查询的结果?

时间:2019-05-19 19:12:31

标签: sparql rdf

该查询应该返回foaf:E21_Person的名称,其中mus:U31_had_function是“ composer”。但是结果将返回所有foaf:name而不过滤函数。

这是我运行的查询:

CONSTRUCT {?F22_Self_Contained_Expression foaf:name ?composerName; mus:U41_has_catalogue_number ?catalogueNumber}
WHERE {
?F22_Self_Contained_Expression mus:U16_has_catalogue_statement/ecrm:P3_has_note ?catalogueNumber.
?F28_Expression_Creation efrbroo:R17_created ?F22_Self_Contained_Expression;
ecrm:P9_consists_of/ecrm:P14_carried_out_by/foaf:name ?composerName.

数据结构如下:

<http://data.doremus.org/artist/adebc97e-fd15-3094-b15b-a7443c26497f>
        a                           ecrm:E21_Person ;
        rdfs:label                  "Francesco Maria Piave" ;
        ecrm:P100i_died_in          <http://data.doremus.org/artist/adebc97e-fd15-3094-b15b-a7443c26497f/death> ;
        ecrm:P131_is_identified_by  "Piave, Francesco Maria (1810-1876)" ;
        ecrm:P98i_was_born          <http://data.doremus.org/artist/adebc97e-fd15-3094-b15b-a7443c26497f/birth> ;
        schema:birthDate            "1810"^^xsd:gYear ;
        schema:deathDate            "1876"^^xsd:gYear ;
        foaf:firstName              "Francesco Maria" ;
        foaf:name                   "Francesco Maria Piave" ;
        foaf:surname                "Piave" .

<http://data.doremus.org/event/f7c6dbae-581e-3ac7-9d8e-d0f4d21d0fcf>
        a                    efrbroo:F28_Expression_Creation ;
        efrbroo:R17_created  <http://data.doremus.org/expression/a92f029b-4616-325a-b526-52ec3a8e3a5c> ;
        efrbroo:R19_created_a_realisation_of
                <http://data.doremus.org/work/599f63b9-47ad-3591-993a-6729dc6b1cca> .

<http://data.doremus.org/event/dde04c04-5e86-3583-9f8f-8adfcbbf2564/activity/3>
        a                        ecrm:E7_Activity ;
        mus:U31_had_function     <http://data.doremus.org/vocabulary/function/librettist> ;
        ecrm:P14_carried_out_by  <http://data.doremus.org/artist/adebc97e-fd15-3094-b15b-a7443c26497f> .

<http://data.doremus.org/event/dde04c04-5e86-3583-9f8f-8adfcbbf2564/activity/2>
        a                        ecrm:E7_Activity ;
        mus:U31_had_function     <http://data.doremus.org/vocabulary/function/librettist> ;
        ecrm:P14_carried_out_by  <http://data.doremus.org/artist/b82c0771-5280-39af-ad2e-8ace2f4ebda3> .

<http://data.doremus.org/event/dde04c04-5e86-3583-9f8f-8adfcbbf2564/activity/1>
        a                        ecrm:E7_Activity ;
        mus:U31_had_function     <http://data.doremus.org/vocabulary/function/composer> ;
        ecrm:P14_carried_out_by  <http://data.doremus.org/artist/b82c0771-5280-39af-ad2e-8ace2f4ebda3> .

<http://data.doremus.org/artist/b82c0771-5280-39af-ad2e-8ace2f4ebda3>
        a                           ecrm:E21_Person ;
        rdfs:label                  "Giuseppe Verdi" ;
        ecrm:P100i_died_in          <http://data.doremus.org/artist/b82c0771-5280-39af-ad2e-8ace2f4ebda3/death> ;
        ecrm:P131_is_identified_by  "Verdi, Giuseppe (1813-1901)" ;
        ecrm:P98i_was_born          <http://data.doremus.org/artist/b82c0771-5280-39af-ad2e-8ace2f4ebda3/birth> ;
        schema:birthDate            "1813"^^xsd:gYear ;
        schema:deathDate            "1901"^^xsd:gYear ;
        foaf:firstName              "Giuseppe" ;
        foaf:name                   "Giuseppe Verdi" ;
        foaf:surname                "Verdi" .

我希望功能为“ composer”的人输出foaf:name

0 个答案:

没有答案