*Deprecated* This material is for historical purposes only See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation
*Deprecated* See https://wiki.duraspace.org/display/VIVODOC/All+Documentation for current documentation
This page is just starting out and we hope can become a resource for useful snippets of information shared among members of the community.
Note that we have a Tools page in Sourceforge that lists more substantial contributions and extensions to VIVO.
A little old but useful: SPARQL Queries for Data Management
CONSTRUCT {
?s rdf:type vivoc:AcademicDegreeGrantingAgent .
}
WHERE
{
GRAPH <http://vitro.mannlib.cornell.edu/default/vitro-kb-2> {
?s rdf:type vivoc:AcademicDegreeGrantingAgent .
OPTIONAL {
?s rdf:type ?type .
FILTER (?type != vivoc:AcademicDegreeGrantingAgent )
}
FILTER (!bound(?type))
}
}
SELECT ?doi ?infoResource_label ?pmid $type ?journal ?issn ?pubVenue ?issue ?startPage ?endPage ?volume ?dateTime WHERE{ ?infoResource vivo:hasPublicationVenue ?pubVenue . ?pubVenue rdf:type bibo:Journal . ?infoResource rdf:type $anyType . ?infoResource bibo:doi ?doi . ?infoResource bibo:pmid ?pmid . ?infoResource bibo:pageStart ?startPage . ?infoResource bibo:pageEnd ?endPage . ?pubVenue bibo:issn ?issn . OPTIONAL { ?pubVenue bibo:volume ?volume } . OPTIONAL { ?pubVenue vivo:DateTimeValue ?dateTime } . OPTIONAL { ?pubVenue bibo:issue ?issue } . ?pubVenue rdfs:label ?journal . ?anyType rdfs:label ?type . ?infoResource rdfs:label $infoResource_label . }
SELECT ?infoResource_label ?type ?author ?firstName ?lastName ?position_label ?department ?pemail WHERE { ?infoResource vivo:hasPublicationVenue ?pubVenue . ?pubVenue rdf:type bibo:Journal . ?infoResource rdf:type ?anyType . ?anyType rdfs:label ?type . ?infoResource vivo:informationResourceInAuthorship ?authorship . ?authorship rdf:type vivo:Authorship . ?authorship vivo:linkedAuthor ?authorURI . ?authorURI rdfs:label ?author . ?infoResource rdfs:label ?infoResource_label . OPTIONAL { $authorURI foaf:firstName ?firstName } . OPTIONAL { $authorURI foaf:lastName ?lastName } . OPTIONAL { $authorURI vivo:primaryEmail ?pemail } . ?authorURI vivo:personInPosition ?position . ?position vivo:positionInOrganization $organization . ?organization rdfs:label ?department . ?position rdfs:label ?position_label . }
Useful for finding good test cases, for example. This is a Vivo 1.5 example, but could be updated pretty easily.
SELECT ?person WHERE { ?person vivo:authorInAuthorship ?authorship. } GROUP BY ?person HAVING (COUNT(?authorship) < 5) LIMIT 1
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
}
{
"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" }
}
]
}
}
Get the code here
https://github.com/senrabc/vivoSparqlExamples/blob/master/SPARQLExamplePositions.html
Set it run here:
http://senrabc.github.io/vivoSparqlExamples/
Live Google Doc: https://docs.google.com/document/d/1FlGWCG0nqQ4TAVZmnKXiVMZnGxpygdcoxRcZsxw4UG0/edit#heading=h.jx71i6lwn9um
Static Document: SPARQLExamplePositions.pdf