Search code examples
sparqldbpedia

DBpedia Request company with CEO (or Director)


I made this request in Dbpedia to get a company name with its abstract but I would like to retrieve the current Director /CEO.

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>        

SELECT DISTINCT ?name ?description 
where{
  ?company a dbpedia-owl:Company.
  ?company foaf:name ?name;
  dbpedia-owl:abstract ?description;
  rdfs:label "Microsoft"@en.
  FILTER( langMatches(lang(?description),"en") )
}

I tried to perform :

PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>        

SELECT DISTINCT ?name ?ceo ?description 
where{
  ?company a dbpedia-owl:Company.
  ?company foaf:name ?name.
  ?company dbpedia-owl:ceo ?ceo;
  dbpedia-owl:abstract ?description;
  rdfs:label "Microsoft"@en.
  FILTER( langMatches(lang(?description),"en") )
}

But I got no result.

Anyone have suggestions about this request ?


Solution

  • With the comment of @AKSW I change my request to get the result I need

    PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
    PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
    
    SELECT DISTINCT ?name (GROUP_CONCAT(?ceo_entity; separator=",") as ?ceos) ?description 
    where
    {
      ?company a dbpedia-owl:Company.
      ?company foaf:name ?name.
      ?company dbpedia-owl:keyPerson/foaf:name ?ceo_entity.
      ?company dbpedia-owl:abstract ?description;
      rdfs:label "Microsoft"@en.
      FILTER( langMatches(lang(?description),"en") )
    }
    

    I explain my request for anyone who need to use and customize it :

    SELECT DISTINCT ?name (GROUP_CONCAT(?ceo_entity; separator=",") as ?ceos) ?description
    

    I Select the name of the company in a column then I concat the names of CEOs as ceos columns and finally I select the description in the last column.

    The first part of my WHERE clause is :

    ?company a dbpedia-owl:Company.
    ?company foaf:name ?name.
    ?company dbpedia-owl:keyPerson/foaf:name ?ceo_entity.
    ?company dbpedia-owl:abstract ?description;
    

    I want ?company is an entity of class Company then I want the property Name in my column ?name. Moreover I ask the property name of the entity keyPerson in the column ( will be concat to get only one row) ?ceo_entity and I ask for the abstract ( description of the company) in the column ?description.

    rdfs:label "Microsoft"@en.
    FILTER( langMatches(lang(?description),"en") )
    

    This part allow me to get only Company with the label "Microsoft" where the description is in English.

    The result will be :

              name             |       ceos                            |description
    "Microsoft Corporation"@en | Bill Gates,John W. Thompson,Satya...  | "Micro..."