I have a query:

SELECT ?s ?type
WHERE 
{ 
  ?s a ?type
}

Let's say I have the data

<x> a <bibo:Book>
<x> a <someOnt:Resource>
<y> a <bibo:Article>
<y> a <someOnt:Resource>

The results I would get from the query above on this data would be:

x bibo:Book
x someOnt:Resource
y bibo:Article
y someOnt:Resource

Any ideas how I would always filter out the rows with someOnt:Resource? Obviously a FILTER (str(?type)!=someOnt:Resource) would actually result in zero rows. I just want results excluding the common type someOnt:Resource.

Thanks!

asked 20 Dec '12, 12:06

robotrobot's gravatar image

robotrobot
235
accept rate: 0%

edited 20 Dec '12, 12:10


Have you tried the filter you describe? It should do exactly what you want: return the (?s, ?type) pairings for which ?type is not someOnt:Resource.

Also, you don't need to use str():

FILTER(?type != someOnt:Resource)

...should work just fine.

permanent link

answered 20 Dec '12, 12:12

lee's gravatar image

lee
3.2k39
accept rate: 37%

1

Actually I wouldn't expect the FILTER with str to work. Comparing string to URI makes little sense. However removing str() should be fine. Or you could use the sameTerm function.

(20 Dec '12, 14:31) Tomasz Plusk... Tomasz%20Pluskiewicz's gravatar image

Yes, what an idiot. Not sure what I did first time around to get it to fail.

(20 Dec '12, 16:58) robotrobot robotrobot'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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×1,302
×24

question asked: 20 Dec '12, 12:06

question was seen: 798 times

last updated: 20 Dec '12, 16:58