Skip to content

Generate new vocabulary POJOs#303

Open
berezovskyi wants to merge 9 commits intomasterfrom
b-vocab-improve
Open

Generate new vocabulary POJOs#303
berezovskyi wants to merge 9 commits intomasterfrom
b-vocab-improve

Conversation

@berezovskyi
Copy link
Copy Markdown
Contributor

@berezovskyi berezovskyi commented Nov 30, 2025

Description

Adds generation for modern vocabulary POJOs, including:

  • a URI constant for every RDFS class
  • a URI constant for every RDFS property
  • an efficient QName helper method every RDFS property
  • Javadoc with the RDFS class/property description for every constant and QName helper
  • @Deprecated annotation for constants and QName helpers that are marked with a description "archaic"

Additional changes:

  • delete the Matlab domain
  • fix the oscl prefix
  • fix the git attributes for MTL files to end with an LF line terminator to prevent issues for Git repos with autocrlf setting on.
  • add only slf4j-api for non-servlet (domain) project POMs.
  • address a compilation warning in the adaptors due to deprecated new Boolean(string) calls by switching to Boolean.valueOf(string)
  • Fix bad license ident BSD-3-Clause not BSD-3-Simple

Checklist

  • This PR adds an entry to the CHANGELOG. _See https://keepachangelog.com/en/1.0.0/ for instructions. Minor edits are exempt.
  • This PR expects some manual changes to the generated code. The needed changes are detailed in the CHANGELOG entry.
  • This PR was tested with at least one code generation, resulting in a working OSLC server.
  • This PR does NOT break the user block code

Issues

Closes #0; Closes #00

(use exactly this syntax to link to issues, one issue per statement only!)

@berezovskyi berezovskyi changed the title B vocab improve Generate new vocabulary POJOs Nov 30, 2025
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the vocabulary POJO generation to create cleaner, more efficient code with improved documentation and caching mechanisms for QName objects.

Key Changes:

  • Generates modern vocabulary classes with URI constants for RDFS classes and properties, QName helper methods, and comprehensive Javadoc
  • Refactors slf4j dependencies to use only slf4j-api for domain projects, moving slf4j-simple to servlet-specific dependencies
  • Fixes deprecated new Boolean() constructor usage in favor of Boolean.valueOf()

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/vocabularyServices.mtl Adds query functions for generating constant names and vocabulary class names with _CLASS and _PROP suffixes
org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/services/resourcePropertyServices.mtl Replaces deprecated new Boolean() constructor with Boolean.valueOf()
org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/files/generateVocabularyConstants.mtl Generates new vocabulary classes with URI constants, QName helpers, Javadoc, and archaic deprecation annotations
org.eclipse.lyo.oslc4j.codegenerator/src/org/eclipse/lyo/oslc4j/codegenerator/config/generatePomXml.mtl Separates slf4j dependencies: slf4j-api for all projects, slf4j-simple only for servlet projects
.gitattributes Enforces LF line endings for MTL template files

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Jad-el-khoury
Copy link
Copy Markdown
Contributor

@berezovskyi What do you think of hte suggested changes.
I regenerated on eclipse-lyo/lyo#848 as well.

i have not changed the file names yet.
to better trace changes (at least for my mind), I think it better to do another PR for file name changes. such a commit simply shows filename changes (and associated code changes), but nothing else.

Copy link
Copy Markdown
Contributor Author

@berezovskyi berezovskyi left a comment

Choose a reason for hiding this comment

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

@Jad-el-khoury Looks good.

One comment: can we get rid of the local names? Or, at least, remove local name concatenation outside the vocab class? For example, eclipse-lyo/lyo@f6384ce#diff-d9fe2502a3e88924c68ec001d4ab09f1832174c0a15e207984574b1f3a2950beR96 should not have

@OslcPropertyDefinition(DctermsVocabularyConstants.NS + "title")

but

@OslcPropertyDefinition(DctermsVocabularyConstants.TITLE_PROP)

Minor nit: can we add a newline before the javadoc start to avoid props and javadocs being squished all together? Just a cosmetic thing.

// [protected ('Copyright')]
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
* Copyright (c) 2025 Contributors to the Eclipse Foundation
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

2026 :D

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