Documentation
¶
Overview ¶
Package validate contains the code to validate SST data contained in a Stage.
Index ¶
- Constants
- Variables
- func DomainAndRange(graph sst.NamedGraph, report *ValidateReport, log Logger) error
- func ExperimentalNamedGraphForAcyclic(graph sst.NamedGraph, log Logger) error
- func ExperimentalNamedGraphForConnectedGraph(graph sst.NamedGraph, log Logger) error
- func ExperimentalNamedGraphForTypeDefinitions(graph sst.NamedGraph, log Logger) error
- func ExtractShapes(stShapes sst.Stage) (shapes *shapesStruct)
- func FunctionalProperty(graph sst.NamedGraph, report *ValidateReport, log Logger) error
- func PrintShapes(shapes *shapesStruct)
- func RdfType(graph sst.NamedGraph, report *ValidateReport, log Logger) error
- func Run(arguments []string) error
- func ValidateStage(st sst.Stage) (ngResult sst.NamedGraph)
- type CheckedSummary
- type ExitStatusError
- type Finding
- type LogLevel
- type LogTarget
- type Logger
- type Rule
- type TripleStringFormatter
- type ValidateReport
- type ValidationKind
- type ValidationName
- type Values
- type ValuesEnum
Constants ¶
View Source
const ( InfoLevel InfoEnterLevel InfoLeaveLevel WarnLevel ErrorLevel )
Variables ¶
View Source
var ( ErrRDFTypeMissing = &tripleFormatterError{message: "rdf:type missing", format: "missing%*s%*s%*s rdf:type"} ErrDomainMismatch = &tripleFormatterError{message: "domain mismatch", format: "domain mismatch%*s%*s%*s"} ErrRangeMismatch = &tripleFormatterError{message: "range mismatch", format: "range mismatch%*s%*s%*s"} )
Functions ¶
func DomainAndRange ¶
func DomainAndRange(graph sst.NamedGraph, report *ValidateReport, log Logger) error
func ExperimentalNamedGraphForAcyclic ¶
func ExperimentalNamedGraphForAcyclic(graph sst.NamedGraph, log Logger) error
func ExperimentalNamedGraphForConnectedGraph ¶
func ExperimentalNamedGraphForConnectedGraph(graph sst.NamedGraph, log Logger) error
func ExperimentalNamedGraphForTypeDefinitions ¶
func ExperimentalNamedGraphForTypeDefinitions(graph sst.NamedGraph, log Logger) error
func ExtractShapes ¶
Extract the Node and Property Shapes and return them as new allocated shapesStruct
func FunctionalProperty ¶
func FunctionalProperty(graph sst.NamedGraph, report *ValidateReport, log Logger) error
func PrintShapes ¶
func PrintShapes(shapes *shapesStruct)
func RdfType ¶
func RdfType(graph sst.NamedGraph, report *ValidateReport, log Logger) error
func ValidateStage ¶
func ValidateStage(st sst.Stage) (ngResult sst.NamedGraph)
Types ¶
type CheckedSummary ¶
type ExitStatusError ¶
type ExitStatusError int
func (ExitStatusError) Error ¶
func (e ExitStatusError) Error() string
func (ExitStatusError) Status ¶
func (e ExitStatusError) Status() int
type Finding ¶
type Finding struct {
Kind ValidationKind `json:"kind"`
Rule Rule `json:"rule"`
Level string `json:"level"` // "error" or "warning"
Message string `json:"message"`
// related triple
S string `json:"subject"`
P string `json:"predicate"`
O string `json:"object"`
Expect string `json:"expect,omitempty"` // "range in {sso:Occurrence | sso:Terminal}"
Actual string `json:"actual,omitempty"` // "object is literal xsd:string"
}
single finding
type Rule ¶
type Rule string
const ( RuleRdfTypeMissing Rule = "RdfType_missing" RuleRdfTypeWrong Rule = "RdfType_wrong" RuleDomainMismatch Rule = "domain_mismatch" RuleRangeMismatch Rule = "range_mismatch" RulePredicateNotProperty Rule = "predicate_not_property" RulePredicateNotKnown Rule = "predicate_not_known" RulePredicateFunctionalProperty Rule = "predicate_is_functional_property" RulePredicateInverseFunctionalProperty Rule = "predicate_is_inverse_functional_property" )
type TripleStringFormatter ¶
type ValidateReport ¶
type ValidateReport struct {
Kinds []ValidationKind `json:"kinds"`
Passed bool `json:"passed"` // if there is any error, then false
Findings map[string][]Finding `json:"findings"` // warnings and errors
Generated time.Time `json:"generated"`
}
func NewReport ¶
func NewReport(kinds ...ValidationKind) ValidateReport
func Validate ¶
func Validate(stage sst.Stage, kinds ...ValidationKind) (*ValidateReport, error)
Validate runs the specified validation kinds on the given stage and returns a report.
func (*ValidateReport) Error ¶
func (r *ValidateReport) Error(ngIRI string, f Finding)
func (*ValidateReport) FormatHumanReadable ¶
func (r *ValidateReport) FormatHumanReadable() string
FormatHumanReadable returns a human-readable formatted validation report
func (*ValidateReport) FormatSummary ¶
func (r *ValidateReport) FormatSummary() string
FormatSummary returns a concise, single-line summary for each finding.
func (*ValidateReport) String ¶
func (r *ValidateReport) String() string
func (*ValidateReport) Warn ¶
func (r *ValidateReport) Warn(ngIRI string, f Finding)
type ValidationKind ¶
type ValidationKind string
const ( KindRdfType ValidationKind = "rdf_type" KindDomainRange ValidationKind = "domain_range" KindFunctionalProperty ValidationKind = "functional_property" )
type ValidationName ¶
type ValidationName string
type Values ¶
type Values[E ValuesEnum] struct { // contains filtered or unexported fields }
Click to show internal directories.
Click to hide internal directories.