Search code examples
semanticssemantic-webdbpedia

DBPedia query to extract all attributes from all the smartphones present in dbpedia


Is it possible to make a query to extract all the attributes from all the smartphones present in DBPedia?


Solution

  • It depends what exactly you need. You basically need to take "all x with type smartphone" and then you need to get everything about that x.

    select distinct * where {
     ?phone dbpedia-owl:type|dbpprop:type dbpedia:Smartphone.
     ?phone ?x ?y
    } 
    

    For example, for getting the CPU, you can write:

    select distinct * where {
         ?phone dbpedia-owl:type|dbpprop:type dbpedia:Smartphone.
         ?phone dbpprop:cpu ?cpu.
    } 
    

    Because if you look at Iphone 5, you will see that there is a CPU property defined. However, for brands it becomes more difficult. Some of the phone have developer defined (look at Iphone 3G), but other such as iPhone 5 has brand, or some have manufacturer, and some might have none. So basically you need to decide which one is it that you are looking for:

    select distinct * where {
         ?phone dbpedia-owl:type|dbpprop:type dbpedia:Smartphone.
         ?phone dbpprop:cpu ?cpu.
         optional { ?phone dbpprop:manufacturer ?developer. }
    }