Skip to content

strange schema.org/location error output #81

Open

Description

@jvandriel

Every time the linter runs into markup containing statements about a schema.org/Person's homeLocation or workLocation it generates an error message:

property schema:location: Subject <http://example.org/#WileECoyote> not compatible with domainIncludes (schema:Action,schema:Event,schema:InteractionCounter,schema:Organization)

Somehow the location property (parent property of the others) gets shown in the output, which rightfully triggers the error message, though I am clueless as to why this property gets added. Is this a bug in the schema.org vocabulary or in the Linter?

What's extra confusing is that I only have seen it happen in regards to Person statements.

Markup example:

<script type="application/ld+json">
{
  "@context": "https://schema.org",
  "@id": "#WileECoyote",
  "@type": "Person",
  "name": "Wile E. Coyote",
  "workLocation": {
    "@id": "#FantasyLand",
    "@type": "Country",
    "name": "Fantasy land"
  }
}
</script>

Activity

  1. gkellogg commented on Aug 22, 2023

    @gkellogg
    Member

    Thanks for bringing up the issue. I think it is, indeed, a bug in the linter, but a challenging one to fix. Person is a valid range of workLocation, even though it is not of location. But, because of that way that subPropertyOf works, :a :workLocation :b. implies :a :location :b..

    The definition of workLocation is:

    :workLocation a rdf:Property ;
        rdfs:label "workLocation" ;
        :domainIncludes :Person ;
        :rangeIncludes :ContactPoint,
            :Place ;
        rdfs:comment "A contact location for a person's place of work." ;
        rdfs:subPropertyOf :location .

    From RDFS, we can see via rdfs5:

    ```xxx rdfs:subPropertyOf yyy . yyy rdfs:subPropertyOf zzz . => xxx rdfs:subPropertyOf zzz .`

    The fact that _location` does not have Person in its range is not an error, as RDFS doesn't have error conditions. The linter is inferring a problem given the inferred triples.

    The fix is probably to filter out errors of this kind, but that's going to be hard to do.

  2. gkellogg commented on Aug 22, 2023

    @gkellogg
    Member

    Actually, the way to address it is probably to add a rule such as the following:

    aaa rdfs:subPropertyOf bbb .
    aaa schema:domainIncludes ddd .
    
    =>
    
    bbb schema:domainIncludes ddd .
    

    Same thing for schema:rangeIncludes.

  3. jvandriel commented on Aug 22, 2023

    @jvandriel
    Author

    Thanks for the reaction @gkellogg.

    I can imagine you have a ton of other things to do before tackling this. I'm already happy to know I wasn't seeing ghosts for once.

    If you'll ever get around to fixing it it'd be great, if not, at least it's documented in this issue.

  4. jvandriel commented on Sep 28, 2023

    @jvandriel
    Author

    Just for the sakes of documenting the issue in case people are searching for it, here's another example of the same issue:

    <script type="application/ld+json">
    {
      "@context": "https://schema.org",
      "@id": "#ShortStory",
      "@type": ["DefinedTerm", "http://www.wikidata.org/entity/Q49084"],
      "termCode": "ShortStory",
      "url": "https://schema.org/ShortStory",
      "inDefinedTermSet": "https://schema.org",
      "sameAs": "https://en.wikipedia.org/wiki/Short_story"
    }
    </script>
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions