|
|
@ -473,22 +473,49 @@ def artwork(): |
|
|
|
copiesincollection = sparql.query().convert() |
|
|
|
|
|
|
|
# related works |
|
|
|
# sparql.setQuery(''' |
|
|
|
# SELECT ?relatedWorks ?relatedWorksLabel ?image ?daterelatedWorks |
|
|
|
# WHERE { |
|
|
|
# { |
|
|
|
# SELECT ?relatedWorks ?relatedWorksLabel (SAMPLE(?daterelatedWorks) AS ?daterelatedWorks) |
|
|
|
# WHERE |
|
|
|
# { VALUES ?work {wd:'''+artwork_id+'''} |
|
|
|
# ?work wdt:P44 ?relatedWorks. |
|
|
|
# OPTIONAL {?relatedWorks wdt:P13 ?daterelatedWorks.} |
|
|
|
# SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } |
|
|
|
# } |
|
|
|
# GROUP BY ?relatedWorks ?relatedWorksLabel |
|
|
|
# ORDER BY ?relatedWorksLabel |
|
|
|
# } |
|
|
|
# OPTIONAL {?relatedWorks wdt:P90 ?image.} |
|
|
|
# } ''') |
|
|
|
sparql.setQuery(''' |
|
|
|
SELECT ?relatedWorks ?relatedWorksLabel ?image ?daterelatedWorks |
|
|
|
WHERE { |
|
|
|
{ |
|
|
|
SELECT ?relatedWorks ?relatedWorksLabel (SAMPLE(?daterelatedWorks) AS ?daterelatedWorks) |
|
|
|
WHERE |
|
|
|
{ VALUES ?work {wd:'''+artwork_id+'''} |
|
|
|
?work wdt:P44 ?relatedWorks. |
|
|
|
OPTIONAL {?relatedWorks wdt:P13 ?daterelatedWorks.} |
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } |
|
|
|
} |
|
|
|
{ VALUES ?work {wd:'''+artwork_id+'''} |
|
|
|
?work wdt:P44 ?relatedWorks. |
|
|
|
OPTIONAL {?relatedWorks wdt:P13 ?daterelatedWorks.} |
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } |
|
|
|
} |
|
|
|
GROUP BY ?relatedWorks ?relatedWorksLabel |
|
|
|
ORDER BY ?relatedWorksLabel |
|
|
|
} |
|
|
|
{ |
|
|
|
SELECT ?relatedWorks ?relatedWorksLabel (SAMPLE(?image) AS ?image) |
|
|
|
WHERE |
|
|
|
{ VALUES ?work {wd:'''+artwork_id+'''} |
|
|
|
?work wdt:P44 ?relatedWorks. |
|
|
|
OPTIONAL {?relatedWorks wdt:P90 ?image.} |
|
|
|
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } |
|
|
|
} |
|
|
|
GROUP BY ?relatedWorks ?relatedWorksLabel |
|
|
|
ORDER BY ?relatedWorksLabel |
|
|
|
} |
|
|
|
OPTIONAL {?relatedWorks wdt:P90 ?image.} |
|
|
|
} ''') |
|
|
|
} |
|
|
|
} |
|
|
|
''') |
|
|
|
sparql.setReturnFormat(JSON) |
|
|
|
relatedworks = sparql.query().convert() |
|
|
|
|
|
|
|