TestActivityQuery
comment Run SPARQL query to list all activities for people
deleteAllVisibleCookies
open /vivo/
assertTitle VIVO
comment Must not be logged in already
clickAndWait link=Log in
assertTitle VIVO Site Administration
comment Must log in as site admin
type username testAdmin
type password Password
clickAndWait loginSubmitMode
assertTitle VIVO Site Administration
comment Navigate to SPARQL Query option on the Site Administration page
clickAndWait link=SPARQL query
assertTitle SPARQL Query
type query PREFIX rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd:   <http://www.w3.org/2001/XMLSchema#>
PREFIX owl:   <http://www.w3.org/2002/07/owl#>
PREFIX swrl:  <http://www.w3.org/2003/11/swrl#>
PREFIX swrlb: <http://www.w3.org/2003/11/swrlb#>
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
PREFIX vivo:  <http://vivo.library.cornell.edu/ns/0.1#>
PREFIX foaf:  <http://xmlns.com/foaf/0.1/>
PREFIX core: <http://vivoweb.org/ontology/core#>
PREFIX bibo: <http://purl.org/ontology/bibo#>

#  This query returns name, Outreach Activity, and  NameURI,
#  filter constrains to only those persons with outreach activity
#  comment the filter line to return all persons

SELECT ?personL ?allActL ?person
WHERE
{
    ?person rdf:type foaf:Person .
    
    OPTIONAL {
        ?person rdfs:label ?personLbl .
        LET (?personL := str(?personLbl)).
    }
    OPTIONAL {
        ?person core:hasActivity ?allAct .
        ?allAct rdfs:label ?allActLbl .
        LET (?allActL := str(?allActLbl)).    
    }
    FILTER (?allActL || "")
}
ORDER BY ?personL
LIMIT 100

clickAndWait //input[@value='Run Query']
assertTitle
comment Verify query results
verifyTextPresent personL
verifyTextPresent "Jane Faculty"
verifyTextPresent allActL
verifyTextPresent "Cancer Treatment Drug Interactions"
verifyTextPresent "Drug Interactions"
verifyTextPresent "Free Cancer Screening Clinic"
verifyTextPresent "Public lectures on reducing stress"
verifyTextPresent "Introduction to Drugs"
verifyTextPresent "AMA"
verifyTextPresent "Private practice"
verifyTextPresent "Relationship Between Stress and Children"
verifyTextPresent person
verifyTextPresent <http://vivo.local.edu/individual/n
goBack
assertTitle SPARQL Query
comment Log out
clickAndWait link=Log out
assertTitle VIVO