简体   繁体   中英

How to integrate several SPARQL queries

This query:

PREFIX pizza: <http://www.data.gov/semantic/data/alpha/1458/dataset-1458.rdf#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dgtwc: <http://data-gov.tw.rpi.edu/2009/data-gov-twc.rdf#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
SELECT ?chem 
FROM <http://ontomatica.com/public/ontologies/dataset-1458.rdf>
WHERE {
    ?s dgtwc:uses_property ?chem .
    FILTER (regex(STR(?chem), '.*sel.*')) .
}

produces this result

This query:

PREFIX pizza: <http://www.data.gov/semantic/data/alpha/1458/dataset-1458.rdf#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?method
FROM <http://ontomatica.com/public/ontologies/dataset-1458.rdf>
WHERE {
    ?s rdfs:label ?method
    FILTER regex(?method, 'selenium', 'i')
    }

produces this result

For <rdf:Description rdf:about="#entry6483"> , how to write the query that would produce this result?

------------------------------------------------------
| chem           | method                 | selenium |
======================================================
| pizza:selenium | "Selenium (mcg/100 g)" | 9        |
------------------------------------------------------

Give that you have the entryno "entry6483"

How about

PREFIX pizza: <http://www.data.gov/semantic/data/alpha/1458/dataset-1458.rdf#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dgtwc: <http://data-gov.tw.rpi.edu/2009/data-gov-twc.rdf#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?chem ?method ?selenium
FROM <http://ontomatica.com/public/ontologies/dataset-1458.rdf>
WHERE {

    pizza:entry6483 ?chem ?selenium .
    ?chem rdfs:label ?method .
    FILTER regex(?method, 'selenium', 'i')

}

Not sure if this is what you are looking for!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM