schema_salad icon indicating copy to clipboard operation
schema_salad copied to clipboard

RDF Schema Output: Property-Triple for SaladRecordField missing if jsonldPredicate contains JsonldPredicate instead of Predicate URI ID only

Open stmbaier opened this issue 1 year ago • 0 comments

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: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://www.example.org/basketSchema#Basket> a rdfs:Class .

<http://www.example.org/basketSchema#hasProducts> a rdf:Property ;
    rdfs:domain <http://www.example.org/basketSchema#Basket> .

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: <http://www.w3.org/2000/01/rdf-schema#> .

<http://www.example.org/basketSchema#Basket> 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 _idpredicate to @id (line 55) or creates the @id predicate (line 57).

stmbaier avatar Jan 04 '24 14:01 stmbaier