OSLC Query text¶
OpenSysML accepts OSLC Query 3.0 text as an element-identification query over the symbols in a parsed model. It is not an OSLC server: this implementation does not provide query capabilities, result containers, service providers, or resource shapes.
Grammar¶
The supported filter is a compound term:
term (" and " term)*
term ::= identifier comparison_op value
| identifier " in " "[" value ("," value)* "]"
comparison_op ::= "=" | "!=" | "<" | ">" | "<=" | ">="
Identifiers are prefixed names. Values may be <uri>, a prefixed name,
quoted strings (with \" and \\ escapes), true, false, or a decimal.
The supported typed literal suffixes are ^^xsd:string, ^^xsd:boolean,
^^xsd:integer, ^^xsd:decimal, and ^^xsd:double.
A <uri> in the SysML namespace and the prefixed name that expands to it are
the same value, so rdf:type=<https://www.omg.org/spec/SysML#PartUsage>,
rdf:type=sysml:PartUsage, and rdf:type="PartUsage" select alike. A model
qualified name is a literal, not a prefixed name: write
sysml:qualifiedName="Robot::Platform::battery" with the quotes. The same
holds for sysml:type, whose values are the qualified names of typing
definitions.
The oslc.where, oslc.select, oslc.orderBy, and oslc.prefix parameters
may be supplied as a URL-encoded query-parameter string. Standard decoding
applies: + means a space and percent-encoded sequences are decoded. A bare
where-clause remains accepted. oslc.orderBy accepts + and - prefixes.
Selection and ordering are comma-separated.
A parameter this implementation does not read is a typed error rather than an
omission, because ignoring one answers a different question than the one asked:
a misspelt oslc.wheree would otherwise select the whole model. A parameter
given twice is refused for the same reason, as is a parameter written with no
value: oslc.select= narrows nothing, so it names what omitting it asks for
(every property) rather than quietly reporting it.
Prefixes and properties¶
sysml: and rdf: are bound by default to the OMG SysML and RDF namespaces.
oslc.prefix adds or rebinds a prefix. An unbound prefix is an error, as is a
bound predicate that is not in this table:
| OSLC predicate | Query property |
|---|---|
rdf:type |
@type |
sysml:qualifiedName |
qualifiedName and element identity |
sysml:name |
name |
sysml:declaredName |
declaredName |
sysml:owner |
owner |
sysml:isAbstract |
isAbstract |
sysml:type |
type |
sysml:multiplicityLower |
multiplicityLower |
sysml:multiplicityUpper |
multiplicityUpper |
Unknown properties fail the query instead of silently returning no matches.
Semantics and choices¶
Equality, inequality, and in compare lexical values. A multi-valued property
matches when any value equals an operand. Ordered comparisons are numeric and
are limited to the two multiplicity properties; * is positive infinity for
those existing model values and operands. Ordered comparisons require exactly
one operand.
Results retain declaration order, with parents before their children, unless
oslc.orderBy is supplied. oslc.select controls the reported property
projection; identity and metamodel type remain present on every result.
oslc.orderBy compares multiplicity properties numerically, with * as
positive infinity, and compares other properties lexically. Missing values
retain the existing ordering behavior.
For ordered multiplicity comparisons, * is positive infinity, and the two
multiplicity properties also compare it as a value: sysml:multiplicityUpper=*
identifies the unbounded usages. On every other property a * value is a
wildcard this implementation does not evaluate, so it is refused rather than
compared lexically into a no-match.
OSLC compound terms have no or, so OSLC text and the structured API Query
surface are deliberately not interchangeable: structured queries retain their
and/or constraint tree, while OSLC text provides the OSLC grammar and
operators.
Unsupported constructs¶
| Construct | Behavior |
|---|---|
scoped_term / nested property query |
Typed error. The OSLC rationale is to match a resource using a related resource's property; graph-pattern traversal is not implemented by this symbol-index evaluator. |
Property wildcard (* in oslc.where, oslc.select, or oslc.orderBy) |
Typed error. Generic property wildcards are not implemented. |
Value wildcard (* compared against any property but the two multiplicity bounds) |
Typed error. On the multiplicity bounds * is the model's own infinity value, not a wildcard. |
oslc.searchTerms |
Typed error. Free-text search is distinct from property identification. |
oslc.properties |
Typed error naming oslc.select, which reports the property projection. |
Any other oslc.* parameter, or a repeated one |
Typed error. |
| Language-tagged literals | Typed error; model properties do not carry language tags. |
Non-xsd: or unsupported xsd: datatypes |
Typed error rather than a potentially misleading lexical comparison. |
API and command surfaces¶
The gRPC QueryRequest.oslc_query field carries this text and is mutually
exclusive with the structured query field. The service advertises the
oslc_query capability in addition to query.
The REPL accepts %query <oslc-query>. The sysml command accepts
-query <oslc-query> alongside the other model modes. Both print one matched
element per line as qualified name and metamodel type, followed by selected
properties. A query that matches nothing says so — the REPL prints no
elements matched, and the command reports it on standard error, so the result
rows on standard output remain one line per match. -query with empty text is a
misuse rather than an absent flag: it is refused instead of starting the
interactive REPL.