-1

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.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
user3052418
  • 21
  • 1
  • 1
  • 3
  • Regarding "I'll be happy if someone can give some links with SPARQL syntax with simple examples, or can explain me how does it work": please note that "Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.". – Joshua Taylor Dec 17 '13 at 15:52
  • 1
    Also, note that "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include **attempted solutions, why they didn't work, and the expected results.**" What have you tried so far, and what didn't work about it? – Joshua Taylor Dec 17 '13 at 15:52
  • 2
    If you browse the StackOverflow questions that are tagged with [tag:sparql], you'll find lots of examples of queries. Have those not been sufficient? – Joshua Taylor Dec 17 '13 at 15:53
  • The [SPARQL 1.1 Query Language](http://www.w3.org/TR/sparql11-query/) document is also good place to start, and has lots of examples. – Joshua Taylor Dec 19 '13 at 12:11

1 Answers1

5

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:

results in 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).

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353