Skip to content
This repository has been archived by the owner on Jun 3, 2023. It is now read-only.

Improve Wikidata query #4

Open
maxbbraun opened this issue Jan 30, 2017 · 4 comments
Open

Improve Wikidata query #4

maxbbraun opened this issue Jan 30, 2017 · 4 comments

Comments

@maxbbraun
Copy link
Owner

The current Wikidata query, for example, takes chains of ownership and subsidiaries into account, but doesn't mix those chains.

There are also probably additional relationships between companies that should be taken into account.

@maxbbraun
Copy link
Owner Author

Some improvements in 02e66ed, 954f462, 725c059, 14d861f, and 77c609b.

@CraigglesO
Copy link

CraigglesO commented Feb 17, 2017

This is a great query system. For some reason I get get no results though:
https://query.wikidata.org/#SELECT%20%3FcompanyLabel%20%3FrootLabel%20%3FtickerLabel%20%3FexchangeNameLabel%0A%20%20%20%20%20WHERE%20%7B%0A%20%20%20%20%20%20%3Fentity%20wdt%3AP646%20%22Apple%22%20.%20%20%23%20Entity%20with%20specified%20Freebase%20ID.%0A%20%20%20%20%20%20%3Fentity%20wdt%3AP176%2a%20%3Fmanufacturer%20.%20%20%23%20Entity%20may%20be%20product.%0A%20%20%20%20%20%20%3Fmanufacturer%20wdt%3AP156%2a%20%3Fcompany%20.%20%20%23%20Company%20may%20have%20restructured.%0A%20%20%20%20%20%20%7B%20%3Fcompany%20p%3AP414%20%3Fexchange%20%7D%20UNION%20%20%23%20Company%20traded%20on%20exchange%20or...%0A%20%20%20%20%20%20%7B%20%3Fcompany%20wdt%3AP127%2B%20%2F%20wdt%3AP156%2a%20%3Froot%20.%20%20%23%20...%20company%20has%20owner.%0A%20%20%20%20%20%20%20%20%3Froot%20p%3AP414%20%3Fexchange%20%7D%20UNION%20%20%23%20Owner%20traded%20on%20exchange%20or%20...%0A%20%20%20%20%20%20%7B%20%3Fcompany%20wdt%3AP749%2B%20%2F%20wdt%3AP156%2a%20%3Froot%20.%20%20%23%20...%20company%20has%20parent.%0A%20%20%20%20%20%20%20%20%3Froot%20p%3AP414%20%3Fexchange%20%7D%20.%20%20%23%20Parent%20traded%20on%20exchange.%0A%20%20%20%20%20%20VALUES%20%3Fexchanges%20%7B%20wd%3AQ13677%20wd%3AQ82059%20%7D%20.%20%20%23%20Whitelist%20NYSE%2C%20NASDAQ.%0A%20%20%20%20%20%20%3Fexchange%20ps%3AP414%20%3Fexchanges%20.%20%20%23%20Stock%20exchange%20is%20whitelisted.%0A%20%20%20%20%20%20%3Fexchange%20pq%3AP249%20%3Fticker%20.%20%20%23%20Get%20ticker%20symbol.%0A%20%20%20%20%20%20%3Fexchange%20ps%3AP414%20%3FexchangeName%20.%20%20%23%20Get%20name%20of%20exchange.%0A%20%20%20%20%20%20SERVICE%20wikibase%3Alabel%20%7B%0A%20%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22en%22%20.%20%20%23%20Use%20English%20labels.%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%7D%20GROUP%20BY%20%3FcompanyLabel%20%3FrootLabel%20%3FtickerLabel%20%3FexchangeNameLabel

@CraigglesO
Copy link

stupid me. For anyone else learning wikidata and the SPARQL system, the freebase requires and ID

https://www.wikidata.org/wiki/Property:P646

https://github.com/maxbbraun/trump2cash/blob/master/analysis.py#L125

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants
@CraigglesO @maxbbraun and others