标准JSON LD包,所有(生成的)Java对象从schema.org

发布于 2025-02-13 02:06:12 字数 794 浏览 0 评论 0原文

我刚刚启动了一个项目,我尝试使用schema.org的架构定义,例如 https://schema.org/postaladdress 作为类和数据库表的蓝图。

通过多个继承层次结构,它并不直接。实施代码是一项无聊的任务,因为我希望Java(和其他语言)中应该有默认的实现。以及用于未经类似数据的简单包装器,例如 https://github.com/google/google/schemaorg-java 对用例无济于事。

是否有一个Java库,其中包括Schema.org的所有定义作为Pojos开箱即用?

我环顾四周,但刚刚发现了 https://github.com/joelittle com./joelittlejohn/jsonschema2pojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojojo ,验证器或序列化/次要化工具。

I've just started a project where I try to use schema definitions from schema.org like https://schema.org/PostalAddress as a blue print for classes and database tables.

It's not straight forward with multiple inheritance hierarchy. And it's a boring task to implement the code, since I expect there should be a default implementation in java (and other languages). And simple wrapper for untyped data like https://github.com/google/schemaorg-java are not helpful for the use case.

Is there a java library where all the definitions from schema.org are included as pojos out of the box?

I've looked around but just found generators like https://github.com/joelittlejohn/jsonschema2pojo, validator or serialization/deserialization tools.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

女皇必胜 2025-02-20 02:06:12

最后,我创建了一个库来从架构定义中生成Java类。

https://github.com/kobee.com/kobee1203/schema-orgg-java

,以及不同版本的模式,以及其他可用的选项。

我制作了一个Maven插件来生成类。

这是一个显示其工作原理的视频:

https://user-images.githubusercontent.com/1423193/199852384-e41869fb-beae-4106-be0f-be0f-148239393b93b9e0c.mp4来自JSON-LD格式。

Finally I created a library to generate Java classes from the schema definitions.

https://github.com/Kobee1203/schema-org-java

It supports inheritance, and different versions of schema, plus other options available.

I made a Maven plugin to generate the classes.

Here is a video that shows how it works:
https://user-images.githubusercontent.com/1423193/199852384-e41869fb-beae-4106-be0f-1482393b9e0c.mp4

I plan to add a module to serialize/deserialize generated Schema.org objects to and from JSON-LD formats.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文