Documentation
¶
Index ¶
- func PaperRecords(response SourceResponse) ([]library.PaperRecord, error)
- type CitationEdge
- type CitationGraphExpansion
- type GraphExpansionBudget
- type GraphExpansionBudgetEstimate
- type Identifiers
- type RequestProvenance
- type ResponseCache
- type ResponseProvenance
- type SearchRun
- type SemanticScholarGraphDirection
- type SemanticScholarGraphQuery
- type SourceConnector
- type SourceQuery
- type SourceRecord
- type SourceResponse
- type StopReason
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PaperRecords ¶
func PaperRecords(response SourceResponse) ([]library.PaperRecord, error)
PaperRecords converts source records into library PaperRecords.
Types ¶
type CitationEdge ¶
CitationEdge is a normalized citing paper -> referenced paper relationship.
type CitationGraphExpansion ¶
type CitationGraphExpansion struct {
StopReason StopReason `json:"stop_reason"`
RequestsUsed int `json:"requests_used"`
SeedID string
Edges []CitationEdge
Records map[string]SourceRecord
RawRef string
}
CitationGraphExpansion is a normalized Semantic Scholar graph neighborhood.
type GraphExpansionBudget ¶
type GraphExpansionBudget struct {
MaxDepth int `json:"maxDepth"`
MaxNodes int `json:"maxNodes"`
MaxAPICalls int `json:"maxApiCalls"`
RetryBudget int `json:"retryBudget"`
ResumeCursor string `json:"resumeCursor,omitempty"`
}
func NormalizeGraphExpansionBudget ¶
func NormalizeGraphExpansionBudget(b GraphExpansionBudget) GraphExpansionBudget
type GraphExpansionBudgetEstimate ¶
type GraphExpansionBudgetEstimate struct {
SchemaVersion string `json:"schemaVersion"`
Source string `json:"source"`
SeedID string `json:"seedId"`
Direction SemanticScholarGraphDirection `json:"direction"`
Limit int `json:"limit"`
MaxDepth int `json:"maxDepth"`
MaxNodes int `json:"maxNodes"`
MaxAPICalls int `json:"maxApiCalls"`
RetryBudget int `json:"retryBudget"`
ResumeCursor string `json:"resumeCursor,omitempty"`
EstimatedAPICalls int `json:"estimatedApiCalls"`
EstimatedMaxNodes int `json:"estimatedMaxNodes"`
WithinBudget bool `json:"withinBudget"`
DryRunPlan string `json:"dryRunPlan"`
}
func EstimateGraphExpansionBudget ¶
func EstimateGraphExpansionBudget(source, seedID string, direction SemanticScholarGraphDirection, limit int, budget GraphExpansionBudget) GraphExpansionBudgetEstimate
type Identifiers ¶
type Identifiers struct {
DOI string
OpenAlexID string
ArXivID string
PMID string
PMCID string
CrossrefID string
SemanticScholarID string
ADSBibcode string
}
Identifiers are normalized scholarly IDs on a source result.
type RequestProvenance ¶
type RequestProvenance struct {
Source string
Query SourceQuery
}
RequestProvenance records what was sent to a SourceConnector.
type ResponseCache ¶
type ResponseCache struct {
// contains filtered or unexported fields
}
ResponseCache stores raw source payloads for reproducible connector runs.
func NewResponseCache ¶
func NewResponseCache(root string) ResponseCache
NewResponseCache creates a filesystem-backed source response cache.
type ResponseProvenance ¶
ResponseProvenance records what came back from a SourceConnector.
type SearchRun ¶
type SearchRun struct {
Connector string
Query SourceQuery
Response SourceResponse
RequestProvenance RequestProvenance
ResponseProvenance ResponseProvenance
}
SearchRun ties connector output to request and response Provenance metadata.
func RunSearch ¶
func RunSearch(ctx context.Context, connector SourceConnector, query SourceQuery) (SearchRun, error)
RunSearch validates a query, invokes a connector, and records request/response Provenance metadata.
type SemanticScholarGraphDirection ¶
type SemanticScholarGraphDirection string
SemanticScholarGraphDirection selects which graph neighborhood to fetch.
const ( SemanticScholarDirectionReferences SemanticScholarGraphDirection = "references" SemanticScholarDirectionCitations SemanticScholarGraphDirection = "citations" SemanticScholarDirectionBoth SemanticScholarGraphDirection = "both" )
type SemanticScholarGraphQuery ¶
type SemanticScholarGraphQuery struct {
PaperID string
Limit int
Direction SemanticScholarGraphDirection
}
SemanticScholarGraphQuery describes a Semantic Scholar citation graph expansion.
type SourceConnector ¶
type SourceConnector interface {
Name() string
Search(context.Context, SourceQuery) (SourceResponse, error)
}
SourceConnector searches one scholarly metadata source.
type SourceQuery ¶
SourceQuery describes a scholarly metadata search request.
type SourceRecord ¶
type SourceRecord struct {
Source string
SourceID string
Title string
Identifiers Identifiers
Year int
Abstract string
Venue string
Publisher string
URLs []string
License string
OpenAccess bool
Metadata map[string]string
}
SourceRecord is a source-specific scholarly metadata result.
type SourceResponse ¶
type SourceResponse struct {
Records []SourceRecord
RawRef string
NextPageCursor string
}
SourceResponse is the normalized response from a SourceConnector.
type StopReason ¶
type StopReason string
StopReason is shared by search sweeps and citation expansion.
const ( StopCompleted StopReason = "completed" StopBudgetExhausted StopReason = "budget_exhausted" StopCoverageSaturated StopReason = "coverage_saturated" StopInterrupted StopReason = "interrupted" StopErrorThreshold StopReason = "error_threshold" )