Skip to content

Commit 39157fb

Browse files
authored
Merge pull request #33 from casework/document_sparql_prefix_order_behavior
Document prefix inheritance
2 parents 586d74e + 539b21f commit 39157fb

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ Two commands are provided to generate output from a SPARQL query and one or more
6969

7070
These commands can be used with any RDF files to run arbitrary SPARQL queries. They have one additional behavior tailored to CASE: If a path query is used for subclasses, the CASE subclass hierarchy will be loaded to supplement the input graph. An expected use case of this feature is subclasses of `ObservableObject`. For instance, if a data graph included an object with only the class `uco-observable:File` specified, the query `?x a/rdfs:subClassOf* uco-observable:ObservableObject` would match `?x` against that object.
7171

72+
Note that prefixes used in the SPARQL queries do not need to be defined in the SPARQL query. Their mapping will be inherited from their first definition in the input graph files. However, input graphs are not required to agree on prefix mappings, so there is potential for confusion from input argument order mattering if two input graph files disagree on what a prefix maps to. If there is concern of ambiguity from inputs, a `PREFIX` statement should be included in the query, such as is shown in [this test query](tests/case_utils/case_sparql_select/subclass.sparql).
73+
7274

7375
#### `case_sparql_construct`
7476

case_utils/case_sparql_construct/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def main() -> None:
6060
help="Override extension-based format guesser."
6161
)
6262
parser.add_argument("out_graph")
63-
parser.add_argument("in_sparql")
63+
parser.add_argument("in_sparql", help="File containing a SPARQL CONSTRUCT query. Note that prefixes not mapped with a PREFIX statement will be mapped according to their first occurrence among input graphs.")
6464
parser.add_argument("in_graph", nargs="+")
6565
args = parser.parse_args()
6666

case_utils/case_sparql_select/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def main() -> None:
7474
"out_table",
7575
help="Expected extensions are .html for HTML tables or .md for Markdown tables."
7676
)
77-
parser.add_argument("in_sparql")
77+
parser.add_argument("in_sparql", help="File containing a SPARQL SELECT query. Note that prefixes not mapped with a PREFIX statement will be mapped according to their first occurrence among input graphs.")
7878
parser.add_argument("in_graph", nargs="+")
7979
args = parser.parse_args()
8080

0 commit comments

Comments
 (0)