Skip to content

Update to Jena 5.2 and Json-LD 1.1#5280

Merged
imsdu merged 4 commits intoBlueBrain:masterfrom
imsdu:update-jena-5-3
Feb 18, 2025
Merged

Update to Jena 5.2 and Json-LD 1.1#5280
imsdu merged 4 commits intoBlueBrain:masterfrom
imsdu:update-jena-5-3

Conversation

@imsdu
Copy link
Collaborator

@imsdu imsdu commented Feb 17, 2025

No description provided.

}

# Json-LD Api configuration
json-ld-api {
Copy link
Collaborator Author

@imsdu imsdu Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ability to have to configure the severity of the parser was introduced a while back to avoid problems down the line with Blazegraph for example because some @id would be invalid.

Since then it was always used as strict and we never had problems so we can just get rid of this configuration and:

  • Use the strict configuration for writes
  • Use the lenient configuration for reads

"result": {
"@type": "sh:ValidationResult",
"focusNode": "nxv:MyShape",
"result:Path": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug from the previous Json-LD library.
Same as #5102

for {
link <- SparqlExternalLink(bindings)
project <-
bindings.get(nxv.project.prefix).map(_.value).flatMap(Iri.absolute(_).toOption).flatMap(projectRefFromId)
Copy link
Collaborator Author

@imsdu imsdu Feb 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was renamed to follow a naming change in Jena which now follows a different RFC for IRIs.
apache/jena#2800

"_attributes": "https://bluebrain.github.io/nexus/vocabulary/attributes",
"_keywords": "https://bluebrain.github.io/nexus/vocabulary/keywords",
"_keywords": {
"@context": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a scoped context

* Support for converting between Jakarta Json and Circe Based on
* https://github.com/circe/circe-jackson/blob/master/shared/src/main/scala/io/circe/jackson/package.scala
*/
package object jakartajson {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nexus and Titanium use different json libraries so this is needed to do a conversion between those.
Before that Nexus was just getting back to a raw string and parse things again with the target library. This had a performance overhead which is now eliminated.

"xsd": "http://www.w3.org/2001/XMLSchema#",
"xsd2": "http://www.w3.org/2001/XMLSchema#",
"Person": "http://schema.org/Person",
"Person2": "http://schema.org/Person",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still need to check that again but it does not take the same prefix when 2 prefixes point to the same target.
It should not happen in real life though.

val input =
json"""{"@context": ["http://localhost/c", {"a": "http://localhost/a"} ], "a": "A", "c": "C", "d": "D"}"""
ExpandedJsonLd(input).rejected shouldEqual RemoteContextCircularDependency(iri"http://localhost/c")
ExpandedJsonLd(input).rejectedWith[ConversionError].getMessage contains "Too many contexts"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With Json-LD 1.1 and imported contexts, the circular dependency check is replaced by a maximum number of loaded contexts

"project": {
"@type": "@id"
},
"valueX": {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason, putting the type meant that the property was not compacted anymore.
The Json-LD playground has the same behaviour.

"@context": [
"https://neuroshapes.org",
{
"@base": "https://bbp.epfl.ch/neurosciencegraph/data/",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When setting a base, it attempts to compact the ids relatively to this value by default.
It was enabled in the previous code but did not work for some reason.

"uHillCoefficient": {
"@id": "https://bbp.epfl.ch/ontologies/core/parameters/uHillCoefficient"
},
"uberon": "http://purl.obolibrary.org/obo/UBERON_",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

targets ending this way do not work anymore.
Consistent with the Json-Ld playground

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean in underscore?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without a / or a #

"_filename": "attachment.json",
"_incoming": "{{fileSelfPrefix}}attachment.json/incoming",
"_mediaType": "application/json",
"_origin" : "Client",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug from the previous library which is now fixed

"@type": [
"Annotation",
"MType:Annotation"
"MTypeAnnotation"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

"@type": [
"MType",
"Annotation:Body"
"AnnotationBody"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

"nValue" : 5,
"unit" : "neurons/mm³",
"value" : 35200.0
"value" : 35200
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conforms to the spec if the decimal value is 0, it gets dropped.

json"""
{
"value" : 0.21388888888888888,
"value" : 0.2138888888888889,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rounding is different now.
It is consistent with the Json-LD playground.

@imsdu imsdu merged commit 3cb4d34 into BlueBrain:master Feb 18, 2025
7 checks passed
@imsdu imsdu deleted the update-jena-5-3 branch February 18, 2025 11:07
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.

2 participants