8000 Remove restriction of 'identifier' to URIs by progval · Pull Request #322 · codemeta/codemeta · GitHub
[go: up one dir, main page]

Skip to content
8000

Conversation

progval
Copy link
Member
@progval progval commented Oct 10, 2023

In practice, it is used to store non-URI identifiers, such as HAL IDs or (arguably ambiguous) names like here:

"identifier": "CodeMeta",

In practice, it is used to store non-URI identifiers, such as HAL IDs or
(arguably ambiguous) names like here:

https://github.com/codemeta/codemeta/blob/7e51f02426f1a6d9e86edb3e99024dd0999ef97e/codemeta.json#L4
@progval progval force-pushed the identifier-not-uri branch from 837a675 to 480774f Compare October 10, 2023 15:46
@progval progval added this to the v4.0 milestone Dec 12, 2023
@moranegg
8000 Copy link
Contributor
moranegg commented May 9, 2025

Is this breaking or non-breaking as it touches the vocabulary but seems like a change that will open the scope for identifier, I'm not sure.

@dgarijo
Copy link
Contributor
dgarijo commented May 9, 2025

I think it is not breaking. It relaxes the constraints of the vocabulary

@progval
Copy link
Member Author
progval commented May 9, 2025

I'd say breaking because this document:

{
  "http://schema.org/identifier": "foo bar"
}

currently gets compacted to:

{
  "@context": "https://w3id.org/codemeta/3.0",
  "schema:identifier": "foo bar"
}

but after the change it would get compacted to:

{
  "@context": "https://w3id.org/codemeta/3.0",
  "identifier": "foo bar"
}

I think it is not breaking. It relaxes the constraints of the vocabulary

Relaxing contraints of a format is a breaking change for readers. (And adding constraints is a breaking change for writers.)

@dgarijo
Copy link
Contributor
dgarijo commented May 9, 2025

sorry, why would it remove/add a namespace? The only thing the id is doing is expecting an object, no?
It would be a problem for a validator, I agree. But the property name does not change with the change.

@progval
Copy link
Member Author
progval commented May 9, 2025

because "foo bar" is not a URI, so it's not a valid @id. Which means the "identifier": { "@id": "schema:identifier", "@type": "@id"}, rule in the context can't be used to replace schema:identifier with identifier.

It would be a problem for a validator, I agree.

or any reader that compacts before parsing. Or for documents that are compacted before being sent to someone else.

@dgarijo
Copy link
Contributor
dgarijo commented May 9, 2025

But identifier is mapped to schema:identifier per the context file...

@progval
Copy link
Member Author
progval commented May 9, 2025

only for values that satisfy the type constraint

@dgarijo
Copy link
Contributor
dgarijo commented May 12, 2025

right, so since we are relaxing the constraint, everything that worked before the change, will continue to work. Unless you have specified a test for your validator against that particular constraint... In any case, if you think this is something that should be delayed then ok.

@progval
Copy link
Member Author
progval commented May 12, 2025

Why are you talking about a validator? This changes the behavior of any spec-compliant implementation of the JSON-LD compaction algorithm.

@progval
Copy link
Member Author
progval commented May 12, 2025

Actually, it changes the behavior of the expansion algorithm too:

{
  "@context": {
    "schema": "http://schema.org",
    "identifier": {"@id": "schema:identifier", "@type": "@id"}
  },
  "identifier": "https://example.org"
}

is expanded to:

[
  {
    "schema:identifier": [
      {
        "@id": "https://example.org"
      }
    ]
  }
]

while

{
  "@context": {
    "schema": "http://schema.org",
    "identifier": {"@id": "schema:identifier"}
  },
  "identifier": "https://example.org"
}

is expanded to

[
  {
    "schema:identifier": [
      {
        "@value": "https://example.org"
      }
    ]
  }
]

as well as the semantics of the document (eg. when loaded in RDFlib), because the value is now a literal (@value) instead of a URI (@id).

@dgarijo
Copy link
Contributor
dgarijo commented May 12, 2025

I did not realize about the resource changing its type from Resource (or Thing) to Literal, that is from:

_:b0 schema:identifier <https://example.org> .

to

_:b0 schema:identifier "https://example.org" .

Apologies! I got confused because I thought it was a namespace issue instead of a change of type in the literal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0