Is there a way to query if ?p1 foaf:knows ?p2 in SPARQL for a graph that does not use the foaf:knows property, but instead uses the property :isParticipantIn ?


:Mike a foaf:Person . :Jane a foaf:Person . :Mike :isParticipantIn :ProjectBiosphere :Jane :isParticipantIn :ProjectBiosphere

So I want to use sparql CONSTRUCT and express that two people know each other if they participate in the same thing, to assert that:

:Mike :knows :Jane :Jane :knows :Mike

What would the SPARQL CONSTRUCT query look like? Should I instead define a new namedIndividual owl:Class, can there be restrictions on properties in OWL?

asked 23 Feb '13, 02:49

edan's gravatar image

accept rate: 0%

Q:What'd the query look like? A: (Omitting namespace prefixes)

 ?x foaf:knows ?y
?x :isParticipantIn ?z .
?y :isParticipantIn ?z .
FILTER (?x != ?y)

The query above will get two different people who work in the same project and create a foaf:knows relation between them.

permanent link

answered 23 Feb '13, 03:25

fadirra's gravatar image

accept rate: 21%

Excellent, thank you! Have you used this technique before? Is there a place to find SPARQL patterns (not tutorials), similar to ontology design patterns website?

(23 Feb '13, 06:09) edan edan's gravatar image

AFAIK, I don't know if such thing (SPARQL querying patterns) exists on the Web. But that might be great if there's one :)

(23 Feb '13, 06:39) fadirra fadirra's gravatar image

With property paths and the comma notation, the pattern here can be written a bit more concisely as ?z ^:isParticipantIn ?x, ?y.

(23 May '14, 18:05) Joshua Taylor Joshua%20Taylor's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 23 Feb '13, 02:49

question was seen: 1,226 times

last updated: 23 May '14, 18:05