简体   繁体   中英

SPARQL CONSTRUCT subClassOf

i want to create a construct query with triples of subjects, that has a certain subclass. That works fine:

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX AS: <http://www.w3.org/ns/activitystreams#>
CONSTRUCT {?s ?p ?o}
WHERE {
    ?s rdf:type/rdfs:subClassOf* AS:Create ;
    ?p ?o .
}

But now i want to ask for more than one type! Something like

WHERE {
    ?s rdf:type/rdfs:subClassOf* AS:Create|AS:Announce ;
    ?p ?o .
}

any idea?

You can use a VALUES clause for this:

VALUES ?cls {AS:Create AS:Announce} ?s rdf:type/rdfs:subClassOf* ?cls ; 

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