TestResearchFocusQuery
comment Run SPARL query to list Research Focus activities
deleteAllVisibleCookies
open /vivo
assertTitle VIVO
comment Must not be logged in already
clickAndWait link=Log in
assertTitle VIVO Site Administration
comment Must login as site admin
type username testAdmin@cornell.edu
type loginPassword Password
clickAndWait loginSubmitMode
assertTitle VIVO Site Administration
comment Navigate to SPARQL query option on 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, Research Focus, and  NameURI,
#  filter constrains to only those persons with ResearchActivity
#  comment the filter line to return all persons

SELECT ?personL ?resActL ?person
WHERE
{
    ?person rdf:type foaf:Person .
    
    OPTIONAL {
        ?person rdfs:label ?personLbl .
        LET (?personL := str(?personLbl)).
    }
    OPTIONAL {
        ?resAct core:researchActivityBy ?person .
        ?resAct rdfs:label ?resActLbl .
        LET (?resActL := str(?resActLbl)).    
    }
    FILTER (?resActL || "")
}
ORDER BY ?personL
LIMIT 100
clickAndWait //input[@value='Run Query']
assertTitle
verifyTextPresent personL
verifyTextPresent "Jane Faculty"
verifyTextPresent "Jane Faculty"
verifyTextPresent resActL
verifyTextPresent "Cancer Treatment Drug Interactions"
verifyTextPresent "Relationship Between Stress and Children"
verifyTextPresent person
verifyTextPresent <http://vivo.local.edu/individual/n
verifyTextPresent <http://vivo.local.edu/individual/n
goBackAndWait 10000
assertTitle SPARQL Query
clickAndWait link=Log out
assertTitle VIVO