### $Id: CompetencyQuestions.txt 2744 2013-09-11 22:47:15Z ramorrismorris $ # Fetched from $HeadURL: https://svn.code.sf.net/p/filteredpush/svn/FP-Design/trunk/ontologies/oadExamples/ManuscriptExamples/CompetencyQuestions.txt $ ### Testable with ManuscriptExamples. See bottom for details. ### ################################################################## # select all triples. Useful if you don't know whether you see \any/ triples SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10 ################################################################## ################################################################## # select (the URIs of ) all the annotations in the triple store PREFIX oa: SELECT ?anno WHERE { ?anno a oa:Annotation } ################################################################## ################################################################## # Competency Question: What annotations are a response to another? # select (the URIs of) all the annotations that are responses to some other annotation PREFIX oa: SELECT ?anno ?responseTo WHERE { ?anno oa:hasTarget ?responseTo . ?responseTo a oa:Annotation } ################################################################## ################################################################## # Competency Question: What evidence for this annotation # would cause me to accept its recommendations into my datastore? # For example, test with ex: . # and return URI of annotation and of its Evidence, as well as any text on the Evidence given by cht:chars PREFIX oa: PREFIX oad: PREFIX cnt: PREFIX ex: SELECT DISTINCT ?theAnno ?theEvidence ?content WHERE { ?theAnno a oa:Annotation . ?theAnno oad:hasEvidence ?theEvidence . OPTIONAL { ?theEvidence cnt:chars ?content } . #harmless if no such } ################################################################## ################################################################## # Competency Question: What datasets have records that been annotated and by which annotations? # We use a UNION to find instances of the two cases: (a)where the Target # is a oa:SpecificResource and so the Target has a value of oa:hasSource, which is the dataset # or (b) the Target is a dataset. # In this example we implement for two particular datasets # Assume we know dataset URIs in our data all have the form # http://purl.oclc.org/net/edu.harvard.huh/guid/uuid/* or # urn:lsid:biocol.org:col:* # We use a regex FILTER to catch only those PREFIX rdf: PREFIX oa: SELECT DISTINCT ?dataset ?anno WHERE { ?anno a oa:Annotation . { ?anno oa:hasTarget ?dataset . } UNION {?anno oa:hasTarget ?tgt . ?tgt oa:hasSource ?dataset . } FILTER (regex(str(?dataset), "^http://purl.oclc.org/net/edu.harvard.huh/guid/uuid/|^urn:lsid:biocol.org:col:", "i")) . } ################################################################## ################################################################## ##Competency Question: Which annotations suggest a change in my data? # We'll build on the previous example, fixing the dataset URIs # PREFIX rdf: PREFIX oa: PREFIX oad: SELECT DISTINCT ?dataset ?anno ?etype WHERE { ?anno a oa:Annotation . ?anno oad:hasExpectation ?expect . ?expect a ?etype . #if not typed, we can't tell what the expectation is { ?anno oa:hasTarget ?dataset . } UNION {?anno oa:hasTarget ?tgt . ?tgt oa:hasSource ?dataset . } FILTER (regex(str(?dataset), "^http://purl.oclc.org/net/edu.harvard.huh/guid/uuid/|^urn:lsid:biocol.org:col:", "i")) . } ################################################################## ##################################################################### #Competency Question: Given an assertion, to what specimens is the assertion applied in some annotation? #For the example, we assume that the Body is a cnt text object whose string begins # "Incorrect catalog data" # The specimen should be either returned as a DwC Triplet or as a specimenID URI PREFIX oa: PREFIX oad: PREFIX dwcFP: PREFIX dwctype: PREFIX dwc: PREFIX cnt: SELECT DISTINCT ?anno ?instCode ?collCode ?catNum ?specimenID WHERE { ?anno a oa:Annotation . #if the Target is a specimen, just return its URI { ?anno oa:hasTarget ?specimen . ?specimenID dwcFP:hasBasisOfRecord dwctype:PreservedSpecimen . } UNION { #if given by a dwcFP:DwCTripletSelector, provide the triplet, but #firs set the body assertions to be matched ?anno oa:hasBody ?body . ?body cnt:chars ?string . #assume assertions are just text FILTER (regex (?string, "^Incorrect catalog data*", "i")) . #Now find the specimens given by (Selector of) the Target ?anno oa:hasTarget ?tgt . ?tgt oa:hasSelector ?selector . ?selector a dwcFP:DwCTripletSelector. ?selector dwc:basisOfRecord "PreservedSpecimen" . ?selector dwc:institutionCode ?instCode . ?selector dwc:catalogNumber ?catNum . OPTIONAL {?selector dwc:collectionCode ?collCode} . } } ##################################################################### ##################################################################### # Competency Question: What are all the current annotations of a specimen record that assert # collection latitude greater than 90 degrees and for which there is presently no response indicating # that a correction has been made? # $Id: CompetencyQuestions.txt 2744 2013-09-11 22:47:15Z ramorrismorris $ # See also BadGeoRef?.n3 and FixedBadGeoRef*.n3 # If all are loaded, the expected outcome is to return onl PREFIX oa: PREFIX bom: PREFIX marl: PREFIX dwc: SELECT DISTINCT ?anno ?response ?restype ?latitude WHERE { { ?anno a oa:Annotation . ?anno oa:motivatedBy oa:editing . ?anno oa:hasTarget ?tgt . ?tgt a oa:SpecificResource . ?tgt oa:hasSelector ?theSelector . ?theSelector dwc:decimalLatitude ?latitude . MINUS { ?response a oa:Annotation . ?response oa:hasTarget ?anno . } . BIND("No responses to this annotation" AS ?response) } UNION { ?anno a oa:Annotation . ?response a oa:Annotation . ?response oa:motivatedBy oa:replying. ?response oa:hasTarget ?anno . ?anno a bom:Issue . ?anno oa:hasTarget ?annoTarget . ?annoTarget a oa:SpecificResource . ?annoTarget oa:hasSelector ?annoSelector . ?annoSelector dwc:decimalLatitude ?latitude . ?anno bom:hasResolution ?resolution . ?resolution a ?restype . FILTER(?restype != bom:Fixed ) } FILTER (?latitude > 90 ) . } ##################################################################### ##################################################################### #Competency Question: What are all the annotations created later than that are about a record #identified by a Darwin Core Triplet whose institutionCode is ? PREFIX rdf: PREFIX xsd: PREFIX oa: PREFIX dwcFP: PREFIX dwc: SELECT DISTINCT ?anno?theDate ?annoDate WHERE { ?anno a oa:Annotation . ?anno oa:annotatedAt ?annoDate . BIND( "2010-12-31T06:14:17Z"^^xsd:dateTime AS ?theDate). ?anno oa:hasTarget ?tgt . ?tgt oa:hasSelector ?sel . ?sel a dwcFP:DwCTripletSelector . ?sel dwc:institutionCode "MCZ" . FILTER ( ?annoDate > ?theDate ) . } ##################################################################### ##################################################################### # Original served at $HeadURL: https://svn.code.sf.net/p/filteredpush/svn/FP-Design/trunk/ontologies/oadExamples/ManuscriptExamples/CompetencyQuestions.txt $ # from $Id: CompetencyQuestions.txt 2744 2013-09-11 22:47:15Z ramorrismorris $ # # A demonstration SPARQL endpoint is deployed at http://filteredpush.org/endpoint/ # Generally, it is populated with the set of sample annotations from # https://svn.code.sf.net/p/filteredpush/svn/trunk/FP-Design/ontologies/oadExamples/ManuscriptExamples # and ontologies from # https://svn.code.sf.net/p/filteredpush/svn/trunk/FP-Design/ontologies/oa # All the files involved should have a line containing "Id:" that can tell you # which version you have in hand. For annotations and ontologies, that line is # available as an rdfs:comment.