Without using SPARQL, you could find all of the type assertions for the resource and verify that dbpedia:Person (or whatever class you are considering to be a person) is one of them. The code would look like this.
from rdflib import Graph, URIRef, RDF
uri = URIRef('http://dbpedia.org/resource/Richard_Nixon')
person = URIRef('http://dbpedia.org/ontology/Person')
g = Graph()
g.parse(uri)
for obj in g.objects(subject=uri, predicate=RDF.type):
if obj == person:
print uri, "is a", person
You asked for an answer that doesn't use SPARQL but running a SPARQL query against the data fetched from DBpedia is quite a clean way way of doing this. Here is sample code for that approach:
from rdflib import Graph, URIRef
def is_person(uri):
uri = URIRef(uri)
person = URIRef('http://dbpedia.org/ontology/Person')
g = Graph()
g.parse(uri)
resp = g.query(
"ASK {?uri a ?person}",
initBindings={'uri': uri, 'person': person}
)
print uri, "is a person?", resp.askAnswer
return resp.askAnswer
uri = URIRef('http://dbpedia.org/resource/Richard_Nixon')
person = URIRef('http://dbpedia.org/ontology/Person')
nixon = 'http://dbpedia.org/resource/Richard_Nixon'
is_person(nixon)
pear = 'http://dbpedia.org/resource/Pear'
is_person(pear)