简体   繁体   中英

How to filter “???” sign using sparql?

I have to data like following:

<rdf:Description rdf:about="http://ru.dbpedia.org/resource/??????????????_??????????">
    <owl:sameAs rdf:resource="http://dbpedia.org/resource/Actuator"/>
</rdf:Description>

<rdf:Description rdf:about="http://sv.dbpedia.org/resource/Ställdon">
    <owl:sameAs rdf:resource="http://dbpedia.org/resource/Actuator"/>
</rdf:Description>

<rdf:Description rdf:about="http://tr.dbpedia.org/resource/Aktüatör">
    <owl:sameAs rdf:resource="http://dbpedia.org/resource/Actuator"/>
</rdf:Description>

<rdf:Description rdf:about="http://uk.dbpedia.org/resource/??????????_????????">
    <owl:sameAs rdf:resource="http://dbpedia.org/resource/Actuator"/>
</rdf:Description>

<rdf:Description rdf:about="http://zh.dbpedia.org/resource/???">
    <owl:sameAs rdf:resource="http://dbpedia.org/resource/Actuator"/>

I want to filter data ??????????_????????. How do i filter out this data?

Following is the query

CONSTRUCT {
    <http://earthquake.linkeddata.it/resource/Actuator> ?p ?o.
    ?s2 ?p2 <http://earthquake.linkeddata.it/resource/Actuator>
} WHERE  {
    {
        <http://dbpedia.org/resource/Actuator> ?p ?o
    } UNION {
        ?s2 ?p2 <http://dbpedia.org/resource/Actuator>
    }
    FILTER regex(str(?s2),"http://dbpedia.org/resource/Actuator$","i")
}

How about somethign like this:

construct {
  <http://earthquake.linkeddata.it/resource/Actuator> ?p1 ?o1.
  ?s2 ?p2 <http://earthquake.linkeddata.it/resource/Actuator>
}
where {
 {
   dbpedia:Actuator ?p1 ?o1
   #-- Either ?o1 must be a non-IRI, or it must be an IRI that doesn't start 
   #-- with http://XX.dbpedia.org/ (i.e., a localized resource).
   filter( !isIRI(?o1) || !regex(str(?o1),"http://[a-z]+.dbpedia.org/" ) )
 } 
 union
 {
  ?s2 ?p2 dbpedia:Actuator
  filter strstarts( str(?s2), "http://dbpedia.org/" )
 }
}

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