Documentation
¶
Overview ¶
Package query contains the transport-neutral element query model and evaluator. Frontends adapt their model/index and wire formats to these types; query semantics do not depend on a transport.
Index ¶
- Constants
- Variables
- func IsOrdered(name string) bool
- func IsProperty(name string) bool
- func MetamodelTypeName(kind symbols.SymbolKind) string
- func MetamodelTypeNameOf(sym *symbols.Symbol) string
- func ParameterNames() []string
- func PropertyNames() []string
- type Element
- type Error
- type ErrorKind
- type Model
- type Operator
- type OrderTerm
- type Predicate
- type PropertyReader
- type Query
Constants ¶
const ( // PropertyID is the element identity property. PropertyID = "@id" // PropertyType is the metamodel type property. PropertyType = "@type" // PropertyName is the effective local name property. PropertyName = "name" // PropertyDeclaredName is the explicitly declared name property. PropertyDeclaredName = "declaredName" // PropertyQualifiedName is the fully qualified name property. PropertyQualifiedName = "qualifiedName" // PropertyOwner is the owning element's qualified name property. PropertyOwner = "owner" // PropertyElementType is the resolved declared element type property. PropertyElementType = "type" // PropertyIsAbstract is the abstractness property. PropertyIsAbstract = "isAbstract" // PropertyMultiplicityLower is the lower multiplicity bound property. PropertyMultiplicityLower = "multiplicityLower" // PropertyMultiplicityUpper is the upper multiplicity bound property. PropertyMultiplicityUpper = "multiplicityUpper" )
Variables ¶
var DefaultPrefixes = map[string]string{ "sysml": rdf.SysML, "rdf": rdf.RDFNS, "xsd": rdf.XSD, }
DefaultPrefixes are the prefixes available without an oslc.prefix binding.
Functions ¶
func IsProperty ¶
IsProperty reports whether name belongs to the closed queryable-property set.
func MetamodelTypeName ¶
func MetamodelTypeName(kind symbols.SymbolKind) string
MetamodelTypeName returns the metamodel type associated with a symbol kind.
func MetamodelTypeNameOf ¶
MetamodelTypeNameOf returns the metamodel type name an element reports as @type, refining symbol kinds that span several metaclasses.
func ParameterNames ¶ added in v0.4.2
func ParameterNames() []string
ParameterNames returns the query parameters this implementation reads, in stable order. It is what an unknown-parameter error lists.
func PropertyNames ¶
func PropertyNames() []string
PropertyNames returns the supported property names in stable order.
Types ¶
type Error ¶
Error is a typed query failure. A query failure must not be represented as an empty result because that would be indistinguishable from a valid no-match.
type ErrorKind ¶
type ErrorKind int
ErrorKind identifies a query failure.
const ( // ErrUnknownProperty identifies an unknown query property. ErrUnknownProperty ErrorKind = iota + 1 // ErrMalformed identifies malformed query syntax or structure. ErrMalformed // ErrUnorderedProperty identifies ordered comparison on an unordered property. ErrUnorderedProperty // ErrUnparsableValue identifies a value an operator cannot parse. ErrUnparsableValue // ErrUnknownScope identifies a scope absent from the model. ErrUnknownScope // ErrNoModel identifies a query without a loaded model. ErrNoModel // ErrUnsupportedScopedTerm identifies an unsupported nested property query. ErrUnsupportedScopedTerm // ErrUnsupportedWildcard identifies an unsupported property wildcard. ErrUnsupportedWildcard // ErrUnsupportedSearchTerms identifies unsupported free-text search. ErrUnsupportedSearchTerms // ErrUnsupportedLiteral identifies an unsupported literal form. ErrUnsupportedLiteral )
type Model ¶
type Model interface {
Candidates(scope []string) ([]*symbols.Symbol, error)
Value(sym *symbols.Symbol, property string) ([]string, bool)
Identity(sym *symbols.Symbol) string
Type(sym *symbols.Symbol) string
}
Model supplies the facts an evaluator needs from a parsed model.
type PropertyReader ¶
type PropertyReader struct {
// contains filtered or unexported fields
}
PropertyReader reads queryable properties from shared model semantics.
func NewPropertyReader ¶
func NewPropertyReader(index *symbols.Index, resolver *resolve.Resolver, model *semantics.Model) *PropertyReader
NewPropertyReader constructs a reader over one index and semantic model.
type Query ¶
Query is the common representation used by structured and OSLC queries.
func ParseOSLC ¶
ParseOSLC parses a where expression. It also accepts a query-parameter string, allowing callers to pass an HTTP-style OSLC query directly.
func ParseParameters ¶
ParseParameters parses oslc.where, oslc.select, oslc.orderBy, and oslc.prefix parameters. Parameter text follows URL query decoding rules.