Hi Amir,

The reasoning you want is the classic deductive reasoning using
classes and subclasses.
Settlement is defined as a subclass of Place (although maybe not
directly). That means that all Things that are Settlements are also
Places. Tehran is a Settlement, so it is also a Place.

If you want to see whether some Thing is a Place, you should look at
the rdf:type and reason your way up via rdfs:subClassOf and see if you
end up at Place.
The class Place in DBpedia has URI
<http://dbpedia.org/ontology/Place>. DBpedia has an option
"transitive", that can be used to make subclasses of subclasses match
as well. I'm not sure that that option is part of SPARQL, so this
option may not work everywhere.

To select 100 items that are in a subclass of Place:

select distinct ?Concept
where {?Concept a ?p .
?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive).} LIMIT 100

With SPARQL ASK you can ask whether there is a match. Is
dbpedia:Tehran in a subclass of Place? (DBpedia says "true")

ASK
 {dbpedia:Tehran a ?p .
?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive).
}

But in case you're looking for something that is only defined as a
Place and not as a subclass of Place, you need to know whether Place
is a subclass of Place.

ASK
 {
dbpedia-owl:Place rdfs:subClassOf dbpedia-owl:Place OPTION (transitive).
}

... says "false".

So you want to ASK if some Thing is a Place or a subclass of a Place.

ASK {
  {
    ?thing a ?p .
    ?p rdfs:subClassOf dbpedia-owl:Place OPTION (transitive).
  }
 UNION
  {
    ?thing a dbpedia-owl:Place .
  }
}

Replace ?thing by the URI of the Thing you want to check.
I think you can construct the queries for Person and Organisation yourself :)

Good luck!

Ben

On 27 February 2013 17:56, Amir Hossein Jadidinejad
<amir.jad...@yahoo.com> wrote:
> Hi,
> I have a simple IE task. Simply want to distinguish between "PERSON",
> "LOCATION" and "ORGANIZATION" concepts. It means that I have a DBpedia's
> URI, what is the type ("PER", "LOC" and "ORG") of this resource?
> Using the following query I can get resource's type:
>
> SELECT * WHERE { <http://dbpedia.org/resource/Tehran> a ?o }
>
> but the output contains different labels (such as "Settlement",
> "IranianProvincialCapitals" and etc.). I don't know how to reason from this
> output?
> Currently, I have a lot of "if...then" conditions which test if the output
> contains "place" (for example) or not:
>
> if (tobject.contains("place") || tobject.contains("locations")
>
>                         || tobject.contains("ProtectedArea")
>                         || tobject.contains("SkiArea")
>                         || tobject.contains("WineRegion")
>                         || tobject.contains("WorldHeritageSite")
>                         || ....)
>
> It's really not a good way. These classes are structured in an ontological
> manner. Would you please help me to construct a query to "reason" the type
> of each resource ("PER", "LOC" and "ORG") in DBpedia?
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_feb
> _______________________________________________
> Dbpedia-discussion mailing list
> Dbpedia-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion
>

------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
Dbpedia-discussion mailing list
Dbpedia-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dbpedia-discussion

Reply via email to