Skip to content

Sample GraphQL queries

Rob Nelson edited this page Jan 17, 2020 · 6 revisions

NOTE Data from VIVO test site at https://vstf-vivo.cloud.duke.edu/

Person

{
  # Mike Conlon's OpenVivo data graphql query:
  person(id: "n7612") {
    id
    geographicLocation
    modTime
    name
    researchAreas {
      id
      label
    }
    positions {
      id
      label
      type
      organizations {
        label
      }
    }
    streetAddress
    phone
    websites {
      label
       url
    }
    geographicFocus {
      label
    }
    awardsAndHonors {
      id
    }
    educationAndTraining {
      id
      field
      abbreviation
      startDate
      endDate
      organization {
        label
      }
    }
    overview
    awardsAndHonors {
      label
      id
    }
    thumbnail
    image
    keywords
    primaryEmail
    additionalEmails
    scopusId
    preferredTitle
    selectedPublications {
      id
      title
      abstractText
      doi
      authorList
      authors {
        id
        label
      }
      publicationVenue {
        label
      }
      publisher {
        label
      }
      publicationDate
    }
    awardsAndHonors {
      label
    }
    clinicalActivities {
      label
    }
    publications {
      label
    }
  }
}

Person Search

query {
  people(
    facets: [{field: "keywords"},
      {field: "researchAreas"},
      {field: "selectedPublicationVenue"},
      {field: "selectedPublicationPublisher"},
      {field: "positions"}
    ],
    filters: [],
    paging: { pageSize:100, pageNumber: 0,
        sort:{ 
          orders: [{direction: ASC, property:"name"}]
        }  
    },
    query: "*",
  ) {
    content {
      id
      keywords
      name
      type
    }
    page {
      totalPages
      number
      size
      totalElements
    }
    facets {
      field
      entries {
        content { 
          value
          count 
        }
      }
    }
  }
}

Document (Publication) Search

query {
  documentsFacetedSearch(
    facets: [{field:"type"}, {field: "numberOfPages"}],
    filters: [{field: "type", value:"Article"}],
    paging: { pageSize:100, pageNumber: 0,
        sort:{ 
          orders: [{direction: ASC, property:"title"}]
        }  
    },
    query: "*",
  ) {
    content {
      id
      title
      type
      numberOfPages
    }
    page {
      totalPages
      number
      size
      totalElements
    }
    facets {
      field
      entries {
        content { 
          value
          count 
        }
      }
    }
  }
}
Clone this wiki locally