*Deprecated* See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation

SPARQL Example: Positions (RUN the exmaple here: http://senrabc.github.io/vivoSparqlExamples/)

Person and Positions Diagram (VIVO 1.4 Position diagram)

 

SPARQL Query to Retrieve the Position for a single Person

Live Results: (Note: You can click on the link below to run this query in realtime at http://sparql.vivo.ufl.edu. Be patient, it make take a few minutes to return.)

(http://sparql.vivo.ufl.edu/VIVO/query?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+rdf%3A++%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+bibo%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%3E%0D%0APREFIX+core%3A+%3Chttp%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23%3E%0D%0APREFIX+ands%3A+%3Chttp%3A%2F%2Fpurl.org%2Fands%2Fontologies%2Fvivo%2F%3E%0D%0ASELECT++*+WHERE%0D%0A%7B%0D%0A%3FURI+core%3AprimaryEmail++%27cpb%40ufl.edu%27.%0D%0A%3FURI+core%3ApersonInPosition+%3FpositionURI.%0D%0A%3FpositionURI+rdfs%3Alabel+%3FPostionlabel%0D%0A%7D&output=text&stylesheet=%2Fxml-to-html.xsl)

 

SPARQL QUERY

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX bibo: <http://purl.org/ontology/bibo/>
PREFIX core: <http://vivoweb.org/ontology/core#>
PREFIX ands: <http://purl.org/ands/ontologies/vivo/>
SELECT  * WHERE
{

?URI core:primaryEmail  'cpb@ufl.edu'.

?URI core:personInPosition ?positionURI.

?positionURI rdfs:label ?Postionlabel

}

Live Results in JSON: 

http://sparql.vivo.ufl.edu/VIVO/query?query=PREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0D%0APREFIX+rdf%3A++%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23%3E%0D%0APREFIX+bibo%3A+%3Chttp%3A%2F%2Fpurl.org%2Fontology%2Fbibo%2F%3E%0D%0APREFIX+core%3A+%3Chttp%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23%3E%0D%0APREFIX+ands%3A+%3Chttp%3A%2F%2Fpurl.org%2Fands%2Fontologies%2Fvivo%2F%3E%0D%0ASELECT++*+WHERE%0D%0A%7B%0D%0A%3FURI+core%3AprimaryEmail++%27cpb%40ufl.edu%27.%0D%0A%3FURI+core%3ApersonInPosition+%3FpositionURI.%0D%0A%3FpositionURI+rdfs%3Alabel+%3FPostionlabel%0D%0A%7D&output=json&stylesheet=%2Fxml-to-html.xsl


JSON Result

{

 "head": {

   "vars": [ "URI" , "positionURI" , "Postionlabel" ]

 } ,

 "results": {

   "bindings": [

     {

       "URI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n64866" } ,

       "positionURI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n136666" } ,

       "Postionlabel": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "Assistant Director and Senior Architect" }

     } ,

     {

       "URI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n64866" } ,

       "positionURI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n31884" } ,

       "Postionlabel": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "Associate Director" }

     } ,

     {

       "URI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n64866" } ,

       "positionURI": { "type": "uri" , "value": "http://vivo.ufl.edu/individual/n908759050" } ,

       "Postionlabel": { "datatype": "http://www.w3.org/2001/XMLSchema#string" , "type": "typed-literal" , "value": "Associate Director, Software Engineering" }

     }

   ]

 }

}


 
 
 

Javascript Example to run query and get back JSON


Get the code here

https://github.com/senrabc/vivoSparqlExamples/blob/master/SPARQLExamplePositions.html

 

Set it run here:

http://senrabc.github.io/vivoSparqlExamples/

 


 

 

 


 

References

Live Google Doc: https://docs.google.com/document/d/1FlGWCG0nqQ4TAVZmnKXiVMZnGxpygdcoxRcZsxw4UG0/edit#heading=h.jx71i6lwn9um

Static Document: SPARQLExamplePositions.pdf

  • No labels