t3-innovation-network / desm

Data Ecosystem Schema Mapper
Apache License 2.0
10 stars 4 forks source link

errors in data export (RDF) #584

Open philbarker opened 2 months ago

philbarker commented 2 months ago

For turtle and JSON-LD output the data exported should follow this domain model

I tested this with a minimal mapping of one term

The JSON-LD output has errors, noted inline below

    "@graph": [
        {
            "@id": "http://desmsolutions.org/TermMapping/293",
            "@type": "desm:AbstractClassMapping",
            "dcterms:created": "2024-09-02",
            "dcterms:dateModified": "2024-09-02",
            "dcterms:title": "Phil DCMI - Dublin Core Metadata Initiative - Thing",
            "desm:abstractClassMapped": 
The property name is abstractClassModeled.
This is not in the @context file.
            {
                     "@id": "https://gopher.desm.staging.c66.me/resources/abstract-classes/Thing"
            },
            "dcterms:hasPart": [
                {
                    "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title"
                }
            ]
        },
        {
            "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title",
you cannot use the id of the spine property as the id of the TermMapping. They are two different things.  
This causes errors in RDF parsing, such as when the .ttl file is produced.
            "@type": "desm:TermMapping",
            "dcterms:isPartOf": {
                "@id": "http://desmsolutions.org/TermMapping/293"
            },
            "desm:mappedterm": [
                {
                    "@id": "https://gopher.desm.staging.c66.me/resources/terms/name"
This is the id of the "local copy" of the property, it should be used below in the property block
that makes assertions about the local mapping.
Q: what happens if two schemas have a property called "name"
                }
            ],
            "desm:mappingPredicate": {
                "@id": "https://gopher.desm.staging.c66.me/resources/predicates/Reworded"
the id of the predicate should not be changed from that which is uploaded.
            },
            "desm:spineTerm": {
                "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title"
you need a block that defines the spine term; it should have: 
  domainIncludes which is the URI of the Abstract Class Concept being mapped.
  rangeIncludes/desm:dataType which is the same as the property it was created from.
  hasTermMapping should indicate the TermMappings it appears in.
            }
        },
        {
            "@id": "schema:name",
this should be the "internal" desm id, as used in the TermMappings
in this case, https://gopher.desm.staging.c66.me/resources/terms/name
            "@type": "rdf:Property",
            "desm:sourceURI": {
                "@id": "schema:name"
make sure this is always the URI of the schema doc, it is more important for
XML and JSON schema than RDF
            },
            "rdfs:subPropertyOf": {
                "@id": "rdfs:label"
this is not the intended use of having rdfs:subPropertyOf here
it should be used only for RDF properties, where it should be
the id of the property in the RDF/S term definition uploaded.
In this case it should be schema:name
            },
            "rdfs:label": "name",
            "rdfs:comment": "The name of the item.",
            "desm:domainIncludes": [
                "schema:Thing"
            ],
            "desm:rangeIncludes": [
                "schema:Text"
            ]
add: desm:inSchema to indicate the local id of the schema
        },
        {
            "@id": "dcterms:title",
should be https://gopher.desm.staging.c66.me/resources/terms/Title 
            "@type": "rdf:Property",
            "desm:sourceURI": {
                "@id": "dcterms:title"
            },
            "rdfs:subPropertyOf": {
                "@id": "http://purl.org/dc/elements/1.1/title"
as above, in this case should be dcterms:title
            },
            "rdfs:label": "Title",
            "rdfs:comment": "A name given to the resource.",
            "desm:domainIncludes": [
                "sdo:CreativeWork"
            ],
            "desm:rangeIncludes": [
                "rdfs:Literal"
            ]
        },
from here down, similar errors to same classes above.
        {
            "@id": "http://desmsolutions.org/TermMapping/292",
            "@type": "desm:AbstractClassMapping",
            "dcterms:created": "2024-09-02",
            "dcterms:dateModified": "2024-09-02",
            "dcterms:title": "Phil DCMI - Dublin Core Metadata Initiative - Thing",
            "desm:abstractClassMapped": {
                "@id": "https://gopher.desm.staging.c66.me/resources/abstract-classes/Thing"
            },
            "dcterms:hasPart": [
                {
                    "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title"
                }
            ]
        },
        {
            "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title",
            "@type": "desm:TermMapping",
            "dcterms:isPartOf": {
                "@id": "http://desmsolutions.org/TermMapping/292"
            },
            "desm:mappedterm": [
                {
                    "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title"
                }
            ],
            "desm:mappingPredicate": {
                "@id": "https://gopher.desm.staging.c66.me/resources/predicates/Identical"
            },
            "desm:spineTerm": {
                "@id": "https://gopher.desm.staging.c66.me/resources/terms/Title"
            }
        }
    ]
}

Missing from the data: desm:Schema information, @id should be the local desm instance id of the uploaded schema, with properties dcterms:title, dcterms:description, desm:version (I see an error in the domain model, will fix) and desm:abstractClass to indicate the relevant Abstract Classes that this schema is mapped to.

I think the Concepts indicating the relevant Abstract Classes and Mapping Predicates should also be included in the download as I suspect many apps won't resolve the links.