Reputation: 21
I'm new to this language and queries. In Protege, I am using the PROV ontology and FOAF and I also added a few of my own instances and classes. With this ontology, I am trying to map the process of a medical research. With the SPARQL queries, I want to quickly retrieve important information about the process.
Looking at the query above, the output makes sense to me. On the left are some research papers (MetaAnalysis belongs to the class MetaAnalysisPaper and Paper2 belongs to the class Research) and on the right are some names that are part of the class Author.
The following is an individual:
I also have the CImin individual, also belonging to the ConfidenceInterval class, it has the same wasGeneratedBy relation, the value is 0.12 and defined in the same way as CImax.
Thank you in advance. My Turtle file was very, very big, so I decided to not upload it here, but if it's necessary, please let me know.
Upvotes: 1
Views: 2007
Reputation: 22053
How do I filter on MetaAnalysis? So that only 'MetaAnalysis wasAttributedTo (name of author)' relations show up, and not Paper2.
You can do this using filter expressions. For example, in your case you could add something like:
FILTER(?property = lol:MetaAnalysis)
I say "something like" this because in your screenshots, it's not clear what namespace the resource MetaAnalysis
is in. I'm guessing it's the default ontology namespace created by Protege (abbreviated to lol
going by the first image), but you may need to double-check that.
How do I filter on Author, let's say for example Biederman? So that only the relation 'MetaAnalysis wasAttributedTo Biederman' shows up.
Same idea, just different variable and value:
FILTER(?object = lol:Biederman)
(this is assuming that Biederman
is a resource URI in your data, and not a literal value - it's not clear from your screenshots)
Put either filter condition in the WHERE clause (after the statement pattern) and you should be good to go.
I want an output that gives me the value (0.39) of the CImax and the value (0.12) of the CImin. Is it possible to get just both these outputs with one query? What would this query look like? And if it isn't possible with one query, what would the query for just the value of CImax look like?
Yes, that's possible, in multiple ways. One thing you could do is create a SPARQL query that gets all individuals of type ConfidenceInterval
(something like ?ci rdf:type lol:ConfidenceInterval .
) and grab their values (e.g ?ci lol:value ?value
). Combine both patterns in a single SPARQL query to get all things that match both patterns. Add additional filters and patterns as you go to make your query more specific, as needed.
More generally speaking: this is really basic SPARQL that you're asking for here. I'd recommend you do a tutorial, there's several really good ones available online, a quick Google will sort you out.
Upvotes: 1