简体   繁体   中英

Simple request in SPARQL, in Protege

can smb help me with SPARQL, because i can't understand it syntax.

How can i view information from this ontology

https://www.dropbox.com/s/m25d6x3ej7ppjw4/MyProject.owl

I should view information about Authors, who create more than 1 method.

Information about methods, that was created early than 1900

And at last, name of "Sphere of using" and methods that was used in sphere.

I'll be happy if someone can give some links with SPARQL syntax with simple examples, or can explain me how does it work.

You could use a query like this one to find authors of more than one method:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX : <http://www.semanticweb.org/vyacheslav/ontologies/2013/11/untitled-ontology-6#>

SELECT ?author (count(?method) as ?numMethods)
WHERE {
  ?method :hasAuthor ?author .
  ?author a :Author .
}
group by ?author
having (?numMethods > 1)

The results look like this:

产生Protégé

A couple of notes though. Ideally you'd want to specify that the method is a actually a method. First, it's generally a good idea to name your classes with singular forms of the word, since it's more natural to say that an individual method “is a Method” rather than “is a Methods”. Anyhow, since the class is named Methods, it would be nice to write the query body as

?method a :Methods .
?method :hasAuthor ?author .
?author a :Author .

but this won't work unless you have a reasoner attached (so that individuals that are declared as members of subclasses of Methods can also be inferred to be members of Methods).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM