TestPositionQuery
comment Run SPARQL query to find positions
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 password 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, position, and  NameURI,
#  filter constrains to only those persons with positions
#  comment the filter line to return all persons

SELECT ?personL ?positionL ?person
WHERE
{
    ?person rdf:type foaf:Person .
    
    OPTIONAL {
        ?person rdfs:label ?personLbl .
        LET (?personL := str(?personLbl)).
    }
    OPTIONAL {
        ?person core:personInPosition ?position .
        ?position rdfs:label ?positionLbl .
        LET (?positionL := str(?positionLbl)).    
    }
    FILTER (?positionL || "")
}
ORDER BY ?personL
LIMIT 100
clickAndWait //input[@value='Run Query']
assertTitle
comment Verify query results
verifyTextPresent personL
verifyTextPresent "Jane Faculty"
verifyTextPresent positionL
verifyTextPresent "Professor"
verifyTextPresent "Lecturer"
verifyTextPresent "Assistant Professor"
verifyTextPresent person
verifyTextPresent <http://vivo.local.edu/individual/n
goBack
assertTitle SPARQL Query
comment Log out
clickAndWait link=Log out
assertTitle VIVO