Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Created August 3, 2018 21:48
Show Gist options
  • Save jcoyne/c5daf0821698e7eb7339305e5d6728a0 to your computer and use it in GitHub Desktop.
Save jcoyne/c5daf0821698e7eb7339305e5d6728a0 to your computer and use it in GitHub Desktop.
Query for authors/editors
PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>
SELECT ?y ?z
WHERE {
<http://example.com/book1> ?p ?o .
?o vivo:relates ?v .
?o rdf:type ?z .
?v vcard:hasName ?t .
?t vcard:value ?y .
}
@cmharlow
Copy link

cmharlow commented Aug 3, 2018

To get a list of names & affiliations for all authors or editors related to a known publication:

PREFIX vivo: <http://vivoweb.org/ontology/core#>
PREFIX vcard: <http://www.w3.org/2006/vcard/ns#>

SELECT ?fname ?lname ?institution ?role
WHERE { 
  <http://example.com/book1> <vivo:relatedBy> ?relationship .
  {?relationship a vivo:Editorship}
  UNION 
  {?relationship a vivo:Authorship}
  ?relationship a ?role ;
                         vivo:relates ?person .
  ?person vcard:hasName ?name .
  ?name vcard:given-name ?fname ;
              vcard:family-name ?lname .
  ?person vivo:relatedBy ?position .
  ?position vivo:relates ?institution .
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment