我正在尝试使用以下查询基于公司的官方网站获取组织的详细信息。它不断地超时。 我需要以下所有字段。有没有优化的方法?我了解OPTIONAL等效于INNER JOIN,并且是超时的原因,但是还有其他方法可以获取这些字段吗?
我正在使用python api并将超时设置为5分钟也无济于事。超时值未设置。
SELECT distinct
(GROUP_CONCAT( DISTINCT ?official_name; separator=";") AS ?official_name)
(GROUP_CONCAT( DISTINCT ?isin; separator=";") AS ?isin)
?item
?itemLabel
?stock_exchange
?stock_exchangeLabel
(GROUP_CONCAT( DISTINCT ?ticker; separator=";") AS ?ticker)
(GROUP_CONCAT( DISTINCT ?other_name; separator=";") AS ?other_name)
(GROUP_CONCAT(DISTINCT ?parent_orgLabel; SEPARATOR = ";") AS ?parent_orgLabel)
(GROUP_CONCAT(DISTINCT ?owned_byLabel; SEPARATOR = ";") AS ?owned_byLabel)
(GROUP_CONCAT(DISTINCT ?instance_of; SEPARATOR = ";") AS ?instance_of)
(GROUP_CONCAT(DISTINCT ?instance_ofLabel; SEPARATOR = ";") AS ?instance_ofLabel)
(GROUP_CONCAT(DISTINCT ?domains; SEPARATOR = ";") AS ?domains)
(GROUP_CONCAT(DISTINCT ?subsidiaryLabel; SEPARATOR = ";") AS ?subsidiaryLabel)
(GROUP_CONCAT(DISTINCT ?owner_ofLabel; SEPARATOR = ";") AS ?owner_ofLabel)
(GROUP_CONCAT(DISTINCT ?part_ofLabel; SEPARATOR = ";") AS ?part_ofLabel)
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
{
{ ?item p:P856 [ ps:P856 <https://www.amazon.com> ]}}
OPTIONAL {
?item p:P856 ?web_domains.
?web_domains ps:P856 ?domains .
}
OPTIONAL { ?item wdt:P1448 ?official_name. }
OPTIONAL { ?item wdt:P946 ?isin. }
OPTIONAL {
?item p:P414 ?SE .
?SE ps:P414 ?stock_exchange .
?SE pq:P249 ?ticker .
}
OPTIONAL { ?item skos:altLabel ?other_name. FILTER (LANG (?other_name) = "en") }
OPTIONAL {
?item wdt:P361 ?part_of.
?part_of rdfs:label ?part_ofLabel.
filter(lang(?part_ofLabel)="en")
}
OPTIONAL {
?item wdt:P749 ?parent_org.
?parent_org rdfs:label ?parent_orgLabel.
filter(lang(?parent_orgLabel)="en")
}
OPTIONAL {
?item wdt:P127 ?owned_by.
?owned_by rdfs:label ?owned_byLabel.
filter(lang(?owned_byLabel)="en")
}
OPTIONAL {
?item wdt:P31 ?instance_of.
?instance_of rdfs:label ?instance_ofLabel.
filter(lang(?instance_ofLabel)="en")
}
OPTIONAL {
?item wdt:P355 ?subsidiary.
?subsidiary rdfs:label ?subsidiaryLabel.
filter(lang(?subsidiaryLabel)="en")
}
OPTIONAL {
?item wdt:P1830 ?owner_of.
?owner_of rdfs:label ?owner_ofLabel.
filter(lang(?owner_ofLabel)="en")
}
}
GROUP BY ?item ?itemLabel ?stock_exchange ?stock_exchangeLabel