core

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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

type CitationEdge struct {
	SourceID string
	TargetID string
}

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.

func (ResponseCache) Read

func (c ResponseCache) Read(ref string) ([]byte, error)

Read returns a raw source response by cache reference.

func (ResponseCache) Write

func (c ResponseCache) Write(source, query string, payload []byte) (string, error)

Write stores a raw source response and returns a stable cache reference.

type ResponseProvenance

type ResponseProvenance struct {
	Source      string
	RecordCount int
	RawRef      string
}

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

type SourceQuery struct {
	Terms      string
	Limit      int
	PageCursor string
	Filters    map[string]string
}

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"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL