Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declarative wrapping #96

Draft
wants to merge 152 commits into
base: main
Choose a base branch
from
Draft

Declarative wrapping #96

wants to merge 152 commits into from

Conversation

langsamu
Copy link
Contributor

@langsamu langsamu commented Aug 5, 2023

Towards annotation-based declarative wrapping inspired by @acoburn.

@langsamu langsamu force-pushed the declarative_wrapping branch from 5028aff to b48bd55 Compare August 5, 2023 12:16
@langsamu langsamu force-pushed the declarative_wrapping branch from b48bd55 to ac9290c Compare August 5, 2023 12:16
@langsamu langsamu force-pushed the declarative_wrapping branch from cda15ab to f446a96 Compare August 6, 2023 16:00
@langsamu langsamu force-pushed the declarative_wrapping branch from f446a96 to f15dd4d Compare August 6, 2023 16:06
@langsamu
Copy link
Contributor Author

langsamu commented Aug 6, 2023

At the moment, in the test module, from these annotated wrapper interfaces

@Dataset
public interface X {
@Graph
interface Y {
@Resource
interface Z {
}
}
}

the following three implementation classes are generated during compilation in declarative/test/target/generated-sources/annotations/com/inrupt/rdf/wrapping/declarative/test.

  1. Dataset
package com.inrupt.rdf.wrapping.declarative.test;

import javax.annotation.processing.Generated;

import org.apache.jena.sparql.core.DatasetGraph;
import org.apache.jena.sparql.core.DatasetImpl;

/**
 * Warning this class consists of generated code.
 */
@Generated(value = "com.inrupt.rdf.wrapping.declarative.processor.Processor", date = "2023-08-06T15:55:50.076240700Z")
public class X_$impl extends DatasetImpl implements com.inrupt.rdf.wrapping.declarative.test.X {
    protected X_$impl(final DatasetGraph original) {
        super(original);
    }
}
  1. Graph
package com.inrupt.rdf.wrapping.declarative.test;

import javax.annotation.processing.Generated;

import org.apache.jena.graph.Graph;
import org.apache.jena.rdf.model.impl.ModelCom;

/**
 * Warning this class consists of generated code.
 */
@Generated(value = "com.inrupt.rdf.wrapping.declarative.processor.Processor", date = "2023-08-06T15:55:50.076240700Z")
public class X$Y_$impl extends ModelCom implements com.inrupt.rdf.wrapping.declarative.test.X.Y {
    protected X$Y_$impl(final Graph original) {
        super(original);
    }
}
  1. Node
package com.inrupt.rdf.wrapping.declarative.test;

import com.inrupt.rdf.wrapping.jena.UriOrBlankFactory;
import com.inrupt.rdf.wrapping.jena.WrapperResource;

import javax.annotation.processing.Generated;

import org.apache.jena.enhanced.EnhGraph;
import org.apache.jena.enhanced.Implementation;
import org.apache.jena.graph.Node;

/**
 * Warning this class consists of generated code.
 */
@Generated(value = "com.inrupt.rdf.wrapping.declarative.processor.Processor", date = "2023-08-06T15:55:50.076240700Z")
public class X$Y$Z_$impl extends WrapperResource implements com.inrupt.rdf.wrapping.declarative.test.X.Y.Z {
    static final Implementation factory = new UriOrBlankFactory(X$Y$Z_$impl::new);

    protected X$Y$Z_$impl(final Node node, final EnhGraph graph) {
        super(node, graph);
    }
}

* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package com.inrupt.rdf.wrapping.declarative.annotations;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: package names in java are generally singular. For annotations, both Jackson and JSON-B use just annotation for their annotation libraries. So I would change annotations to just annotation.

Also, I would probably remove the declarative qualifier in the name, so just com.inrupt.rdf.wrapping.annotation

@langsamu
Copy link
Contributor Author

Have now added wrap methods.

Generating with JDeparser instead of string manipultaion, which is lovely. It's how JBoss Logging Tools generate their implementations.

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