Comments (7)
Hi,
this behavior is intentional. JB4JSON-LD will try to find the most specific matching type and if there are multiple (D'
and D''
in your case), the library cannot decide which one to use. Using the parent (D
) is theoretically possible, but what if it is abstract, or an interface? In addition, if D
is a concrete class, the JSON can contain attributes mapped by D'
or D''
which in this case wouldn't match in D
.
I suppose a configuration parameter could be used to override the default behavior in favor of using the parent, with the risk of loosing some attributes. In that case, a PR would be welcome.
from jb4jsonld.
I think the planned support for custom (de)serializers would help in this case as well. See #28
from jb4jsonld.
Honestlt It is quite common in the semantic web realm that a class has some subclasses not necessarily disjoint. So we have to think about a solution in which no exception is thrown in this case.
from jb4jsonld.
Fair enough. @psiotwo , what do you think?
from jb4jsonld.
but what if it is abstract, or an interface?
Good point. We can try to go higher in the hierarchy.
with the risk of loosing some attributes.
If D has unmapped properties, the additional D',D'' props should appear there.
I think it makes sense to support this parent resolution and a configuration parameter for using parents optimistically should be appropriate.
from jb4jsonld.
In this case one expect an object of class D, so returning an individual of any of its subclasses D' or D'' is good enough.
from jb4jsonld.
Implemented in 0.8.2. Configured via the enableOptimisticTargetTypeResolution
and preferSuperclass
parameters. Feel free to check it out and reopen (or report a new issue) if there are any problems.
from jb4jsonld.
Related Issues (20)
- Allow IRI aliasing handling. HOT 2
- Relaxing check about single cardinality constraints in json deserialization DefaultInstanceBuilder) HOT 2
- Disjoint polymorphic object parameter ranges HOT 2
- Support for custom serializers/deserializers HOT 3
- NoClassDefFoundError: cz/cvut/kbss/jopa/model/MultilingualString on version 0.8.2 HOT 4
- Unable to serialize individuals in unmapped properties HOT 1
- Classpath scanning does not work for Spring Boot-based JARs HOT 2
- issues when deserializing subclasses HOT 1
- deserializing subclass defined in external maven artifact HOT 2
- MultilingualString values without language tag are not supported HOT 1
- Support JSON-LD 1.1
- Per-attribute format configuration
- Allow property overriding
- Support embedded contexts HOT 1
- Support external contexts
- Support mapping enum constants to individuals HOT 1
- Serialization with embedded context attempts to add the context to incorrect node
- Support serializing individuals as string with context info HOT 1
- ClasspathScanner is unable to handle Spring Boot 3.2.x JARs HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jb4jsonld.