如何在Sparql中获取数据属性

时间:2014-02-28 15:23:00

标签: sparql owl

我有这段本体论:

<NamedIndividual rdf:about="&titan;BE_Digit_Photo_Srl">
        <rdf:type rdf:resource="&v1;BusinessEntity"/>
        <Process:name>Digit Photo Srl</Process:name>
        <v1:category>E-Commerce</v1:category>
        <schema:description>a simple description</schema:description>
        <v1:offers rdf:resource="&titan;Offer_DigitFoto_Nikon_Coolpix_P520_1"/>
</NamedIndividual>

现在我如何获得Process:name,v1:category和schema:通过SPARQL查询描述给定的BE_Digit_Photo_Srl个体?

我是SPARQL和本体的新手,所以请帮助我。 提前致谢

修改 我已经用这种方式解决了:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gr: <http://purl.org/goodrelations/v1#>
PREFIX v1: <http://www.ebusiness-unibw.org/ontologies/consumerelectronics/v1#>
PREFIX process: <http://localhost:8080/OntologyRepository/Process.owl#>
PREFIX schema: <http://schema.org/>
SELECT ?name ?desc ?cat ?offers
 WHERE { ?individual  process:name  ?name .
 ?individual  schema:description  ?desc .
 ?individual  gr:category  ?cat. 
 ?individual gr:offers ?offers.
 FILTER regex(str(?individual), 'BE_Digit_Photo_Srl', 'i') }

我希望它可以帮助其他用户:)

1 个答案:

答案 0 :(得分:1)

我已经用这种方式解决了:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX gr: <http://purl.org/goodrelations/v1#>
PREFIX v1: <http://www.ebusiness-unibw.org/ontologies/consumerelectronics/v1#>
PREFIX process: <http://localhost:8080/OntologyRepository/Process.owl#>
PREFIX schema: <http://schema.org/>
SELECT ?name ?desc ?cat ?offers
 WHERE { ?individual  process:name  ?name .
 ?individual  schema:description  ?desc .
 ?individual  gr:category  ?cat. 
 ?individual gr:offers ?offers.
 FILTER regex(str(?individual), 'BE_Digit_Photo_Srl', 'i') }