Topic on User talk:VIGNERON

Jump to navigation Jump to search
93.124.192.11 (talkcontribs)

Hi VIGNERON,


I've tried the query that you provided and it works fine. I tried writing one of my own .


SELECT ?item ?ISIN ?official_name ?official_nameLabel ?official_website WHERE {

  OPTIONAL { ?item wdt:P1448 ?official_name. }

  OPTIONAL { ?item wdt:P946 ?ISIN. }

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

  ?item wdt:P31 wd:Q783794.

  ?item wdt:P856 <https://www.google.com>

}


This doesn't return anything. I'm trying to understand what was wrong here. Why wouldn't it return the details about Google?

VIGNERON (talkcontribs)

In your query, your asking for items that are exactly company (Q783794) but Google (Q95) is a subclass. You need to look at the subclasses (subclass of (P279)), like this :

SELECT ?item ?ISIN ?official_name ?official_nameLabel ?official_website WHERE {

 OPTIONAL { ?item wdt:P1448 ?official_name. }
 OPTIONAL { ?item wdt:P946 ?ISIN. }
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
 ?item wdt:P31/wdt:P279* wd:Q783794.
 ?item wdt:P856 <https://www.google.com>

}

93.124.192.11 (talkcontribs)
93.124.192.11 (talkcontribs)

I'm using the below query which works fine to check for all possible combinations of the domains which works well but the Ticker symbol is not being returned. I'm sure I'm querying the property in an incorrect way but not sure how to get an indirect property. Kindly help.


SELECT distinct

  ?official_name

  (GROUP_CONCAT( DISTINCT ?isin; separator=";") AS ?isin)

  ?item

  ?itemLabel

  ?stock_exchange

  ?stock_exchangeLabel

  (GROUP_CONCAT( DISTINCT ?other_name; separator=";") AS ?other_name)

WHERE {

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

  ?item (wdt:P31/wdt:P279*) wd:Q783794.

  {

            { ?item wdt:P856 <https://www.google.com> }   

      UNION { ?item wdt:P856 <http://www.google.com> }

      UNION { ?item wdt:P856 <https://www.google.com/> }

      UNION { ?item wdt:P856 <http://www.google.com/> }

      UNION { ?item wdt:P856 <https://google.com> }   

      UNION { ?item wdt:P856 <http://google.com> }

      UNION { ?item wdt:P856 <https://google.com/> }

      UNION { ?item wdt:P856 <http://google.com/> }     

  }  

  OPTIONAL { ?item wdt:P1448 ?official_name. }

  OPTIONAL { ?item wdt:P946 ?isin. }

  OPTIONAL { ?item wdt:P414 ?stock_exchange. }  

  OPTIONAL { ?item skos:altLabel ?other_name. FILTER (LANG (?other_name) = "en") }

}

GROUP BY ?official_name ?item ?stock_exchange ?itemLabel ?stock_exchangeLabel

93.124.192.11 (talkcontribs)

SELECT distinct

  ?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)

WHERE {

  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

  ?item (wdt:P31/wdt:P279*) wd:Q783794.

  {

            { ?item wdt:P856 <https://www.google.com> }   

       

  }  

  OPTIONAL { ?item wdt:P1448 ?official_name. }

  OPTIONAL { ?item wdt:P946 ?isin. }

  OPTIONAL { ?item wdt:P414 ?stock_exchange. }  

  OPTIONAL { ?item skos:altLabel ?other_name. FILTER (LANG (?other_name) = "en") }

  ?SE pq:P249 ?Ticker

}

GROUP BY ?official_name ?item ?stock_exchange ?itemLabel ?stock_exchangeLabel


This one works perfectly fine. Thanks for the help. :)

Reply to "Company details from Domain name"