common-workflow-language / common-workflow-language/schema_salad
RDF Schema Output: Property-Triple for SaladRecordField missing if jsonldPredicate contains JsonldPredicate instead of Predicate URI ID only
- Dominant language
- Python
- Stars
- 86
- Forks
- 64
- Avg merge
- 19h 24m
- Merged PRs (30d)
- 19
Description
### Description
If a SALAD Schema contains a SaladRecordField with a `jsonldPredicate` object instead of a simple string for the predicate URI no Property-Triple is contained anymore in the RDFS output.
### Minimal working example
**Input schema**:
```
$base: "http://www.example.org/basketSchema
$graph:
- name: Basket
type: record
documentRoot: true
fields:
- name: basket
type:
type: array
items: string
jsonldPredicate: "http://www.example.org/basketSchema#hasProducts"
```
**RDFS Output**:
```
@prefix rdf: .
@prefix rdfs: .
a rdfs:Class .
a rdf:Property ;
rdfs:domain .
```
### Equivalent not working example
**Input schema**:
```
$base: "http://www.example.org/basketSchema"
$graph:
- name: Basket
type: record
documentRoot: true
fields:
- name: basket
type:
type: array
items: string
jsonldPredicate:
_id: "http://www.example.org/basketSchema#hasProducts"
```
**RDFS Output**:
```
@prefix rdfs: .
a rdfs:Class .
```
### Cause Analysis
In the `jsonld_context.py` in the method `process_type` in line 142 is, if the `jsonldPredicate` predicate is an object, erroneously checked for the property `"_@id"`, which is never set.
The `pred` method used to acquire the predicate object (line 135) re-writes the `_id`predicate to `@id` (line 55) or creates the `@id` predicate (line 57).
Contributor guide
Research direction
Start in jsonld_context.py at process_type around line 142, then trace the pred method and its _id-to-@id handling around lines 135, 55, and 57. Verify the minimal schema with an object-form jsonldPredicate produces the expected RDF Property triple and retains the existing string-form behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 62/100