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