我尝试进行SPARQL查询,但是我失败了。 我有三个属性需要我这样说:
SELECT DISTINCT ?locality ?museRes ?calendar ?category
FROM <http://opendata.cs.pub.ro/repo/context/TTT>
WHERE {
{
?museRes vCard:locality ?locality FILTER (regex(?museRes, "odaia_bunicii", "i")) .
?museRes vCard:category ?category FILTER (regex(?museRes, "odaia_bunicii", "i")).
?museRes vCard:hasCalendarRequest ?calendar FILTER (regex(?museRes, "odaia_bunicii", "i"))
}
}
Romanian OpenData SPARQL endpoint 中的
问题是三个属性是另外三个超级属性(dcterms:spatials,dcterms:description和opendata:MuseumTour)的一部分,而且这种方法不起作用。我试过OPTION运算符,但它只显示我?museRes和?locality值甚至?calendar和?category都不是空的。
最后,我尝试使用UNION而不是OPTION,但它仅适用于一个UNION,我需要使用两个UNION运算符。
如何在上述RDF中询问vCard:locality vCard:category和vCard:hasCalendarRequest?
<rdf:RDF
xmlns:marcrel="http://www.loc.gov/loc.terms/relators/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dcmitype="http://purl.org/dc/dcmitype/"
xmlns:opendata="http://opendata.cs.pub.ro/property/"
xmlns:vCard="http://www.w3.org/2006/vcard/ns#"
xmlns:dbPedia="http://dbpedia.org/ontology/"
xmlns:cdtype="http://purl.org/cld/cdtype/"
xmlns:cld="http://purl.org/cld/terms/">
<dbPedia:Museum rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/">
<dcterms:description>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Info/">
<dc:identifier>7172383</dc:identifier>
<opendata:FoundingYear>2016</opendata:FoundingYear>
<dc:title xml:lang="en"></dc:title>
<dcterms:isReferencedBy></dcterms:isReferencedBy>
<marcrel:OWN>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Info/Own/">
<dc:identifier></dc:identifier>
<dc:title></dc:title>
</rdf:Description>
</marcrel:OWN>
<opendata:Accreditation></opendata:Accreditation>
<dc:subject>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Info/Subject/">
<vCard:value xml:lang="en"></vCard:value>
<vCard:label xml:lang="en">Specific (Principal) profile</vCard:label>
<vCard:label>Profil specific (principal)</vCard:label>
<vCard:value>Etnografie</vCard:value>
<vCard:label>Profil general</vCard:label>
</rdf:Description>
</dc:subject>
<dc:title>"Odaia Bunicii" - Centrul Folcloric Grădiniţa, Galicea Mare</dc:title>
<vCard:hasCategory>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Info/Category/">
<opendata:MainCategory xml:lang="en">Museum</opendata:MainCategory>
<opendata:MainCategory>Muzeu</opendata:MainCategory>
<vCard:category xml:lang="en"></vCard:category>
<vCard:category>Muzeu Comunal</vCard:category>
</rdf:Description>
</vCard:hasCategory>
<dcterms:description>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Info/Description/">
<opendata:Historic xml:lang="en"></opendata:Historic>
<opendata:Historic></opendata:Historic>
<dcterms:abstract xml:lang="en"></dcterms:abstract>
<dcterms:abstract></dcterms:abstract>
<dcterms:description xml:lang="en"></dcterms:description>
<dcterms:description>Centrul folcloric al grădiniţei Galicea Mare este situat în incinta Grădiniţei nr.1, structură a Şcolii Gimnaziale Galicea Mare, judeţul Dolj, pe drumul european E56. Pentru a readuce la viaţă şi a reînvia atât tradiţiile cât şi portul popular românesc, a luat naştere „Odaia bunicii”, un loc in care obiectele prind viaţă şi creează o atmosferă caldă, plina de dragostea ţaranilor de altadată. Expoziţia permanentă, deschisă în 2016, este concepută într-o manieră tradiţională, fiecare obiect aşteptând să fie folosit pentru a-şi arata maiestria, astfel: patul cu tablii de lemn şi saltea de paie aşteaptă să odihnească omul, măsuţa din lemn şi scaunelele aşteaptă cu nerăbdare să fie servită cina, dar şi războiul ţăranesc unde femeile ţeseau macate ne reamintesc nouă, celor mari, şi îi învaţă pe cei mici despre obiceiurile şi tradiţiile româneşti de altădată.</dcterms:description>
<opendata:Relevance xml:lang="en">Local</opendata:Relevance>
<opendata:Relevance>Locală</opendata:Relevance>
</rdf:Description>
</dcterms:description>
</rdf:Description>
</dcterms:description>
<dbPedia:Building>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Building/">
<dbPedia:HistoricBuilding></dbPedia:HistoricBuilding>
<dcterms:abstract xml:lang="en"></dcterms:abstract>
<dcterms:abstract></dcterms:abstract>
<dc:identifier></dc:identifier>
<dc:type xml:lang="en">Building</dc:type>
<dc:type>Cladire</dc:type>
</rdf:Description>
</dbPedia:Building>
<opendata:MuseumTour>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Tour/">
<vCard:hasCalendarRequest xml:lang="en">Unspecified</vCard:hasCalendarRequest>
<vCard:hasCalendarRequest>luni-vineri 8:00-13:00</vCard:hasCalendarRequest>
<opendata:VirtualTour></opendata:VirtualTour>
</rdf:Description>
</opendata:MuseumTour>
<opendata:Contact>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/">
<vCard:url>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/URI/">
<opendata:SocialMediaUri>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/URI/SocialMediaUri/">
<vCard:label>Link-uri social media.</vCard:label>
<vCard:hasValue></vCard:hasValue>
</rdf:Description>
</opendata:SocialMediaUri>
<opendata:CimecUri>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/URI/CimecUri/">
<vCard:label>Link-ul catre portalul CIMEC.</vCard:label>
<vCard:hasValue>http://ghidulmuzeelor.cimec.ro/id.asp?k=2030&-„Odaia-bunicii”-Centrul-folcloric-Gradinita,-Galicea-Mare-GALICEA-MARE-Dolj</vCard:hasValue>
</rdf:Description>
</opendata:CimecUri>
<opendata:WebUri>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/URI/WebUri/">
<vCard:label>Link-ul catre site-ul muzeului.</vCard:label>
<vCard:hasValue></vCard:hasValue>
</rdf:Description>
</opendata:WebUri>
</rdf:Description>
</vCard:url>
<vCard:Individual>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Individual/">
<opendata:Employee>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Individual/Employee/">
<vCard:hasName>Gologan Veronica</vCard:hasName>
<vCard:hasRole>Profesor</vCard:hasRole>
</rdf:Description>
</opendata:Employee>
<opendata:Manager>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Individual/Manager/">
<vCard:hasName>Văduva Cristian</vCard:hasName>
<vCard:hasRole>Director</vCard:hasRole>
</rdf:Description>
</opendata:Manager>
</rdf:Description>
</vCard:Individual>
<vCard:hasEmail></vCard:hasEmail>
<vCard:hasTelephone>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Telephone/">
<vCard:Fax>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Telephone/Fax/">
<vCard:rev></vCard:rev>
<vCard:value></vCard:value>
</rdf:Description>
</vCard:Fax>
<vCard:Work>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Contact/Telephone/Work/">
<vCard:rev></vCard:rev>
<vCard:value>0251.316.006; 0762.278.850</vCard:value>
</rdf:Description>
</vCard:Work>
</rdf:Description>
</vCard:hasTelephone>
</rdf:Description>
</opendata:Contact>
<dcterms:spatials>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Spatials/">
<vCard:hasAddress>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Spatials/Address/">
<vCard:postal-code>207270</vCard:postal-code>
<vCard:region>Dolj</vCard:region>
<dbPedia:AdministrativeRegion>Galicea Mare</dbPedia:AdministrativeRegion>
<vCard:hasLocality>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Spatials/Locality/">
<opendata:Siruta></opendata:Siruta>
<vCard:locality>Galicea Mare</vCard:locality>
</rdf:Description>
</vCard:hasLocality>
<vCard:street-address>Str. Calafatului nr. 10</vCard:street-address>
</rdf:Description>
</vCard:hasAddress>
<opendata:Access xml:lang="en"></opendata:Access>
<opendata:Access></opendata:Access>
<vCard:hasGeo>
<rdf:Description rdf:about="http://opendata.cs.pub.ro/resource/_Odaia_Bunicii-Centrul_Folcloric_Gradinita_Galicea_Mare_Dolj/Spatials/GeoPos/">
<vCard:longitude>23.3</vCard:longitude>
<vCard:latitude>44.1</vCard:latitude>
<vCard:label>Localitate</vCard:label>
</rdf:Description>
</vCard:hasGeo>
</rdf:Description>
</dcterms:spatials>
</dbPedia:Museum>
</rdf:RDF>
答案 0 :(得分:0)
更好的答案......
SELECT DISTINCT ?o ?museum_res ?locality ?calendar ?category ?importanta
FROM <http://opendata.cs.pub.ro/repo/context/TTT>
WHERE {
{
?museum_res ?p ?o.
?e dc:title ?title.
?a vCard:locality ?locality.
?b vCard:category ?category.
?c vCard:hasCalendarRequest ?calendar.
?d openDataP:Relevance ?importanta.
FILTER (
UCASE(?o) = UCASE("http://dbpedia.org/ontology/Museum") &&
contains(?title, "Odaia") &&
contains(?e, ?museum_res) &&
contains(?a, ?museum_res) && langMatches(lang(?locality),"") &&
contains(?b, ?museum_res) && langMatches(lang(?category),"") &&
contains(?c, ?museum_res) && langMatches(lang(?calendar),"") &&
contains(?d, ?museum_res) &&langMatches(lang(?importanta),"")
)
}
}
ORDER BY ?museum_res
LIMIT 1200
答案 1 :(得分:-1)
3-4小时后我找到了解决方案:
SELECT DISTINCT ?locality ?category ?calendar ?importanta
FROM <http://opendata.cs.pub.ro/repo/context/ilie>
WHERE {
?a vCard:locality ?locality. FILTER (regex(?a, "odaia_bunicii", "i")).
?b vCard:category ?category. FILTER (regex(?b, "odaia_bunicii", "i")).
?c vCard:hasCalendarRequest ?calendar. FILTER (regex(?c, "odaia_bunicii", "i")).
?d openDataP:Relevance ?importanta. FILTER (regex(?d, "odaia_bunicii", "i")).
}