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

Switch to 2.3.0-SNAPSHOT in the RM adaptor #12

Closed
wants to merge 1 commit into from
Closed

Conversation

berezovskyi
Copy link
Member

@berezovskyi berezovskyi commented Feb 3, 2018

This is the code needed to maintain the non-abbrev output, see more details in https://issues.apache.org/jira/browse/JENA-1477


This change is Reviewable

// trigger Jena init
ModelFactory.createDefaultModel();
// force plain XML writer
RDFWriterFImpl.alternative(null);
Copy link

Choose a reason for hiding this comment

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

Is this now out of date based on:
We will:

  1. Depend on 'apache-jena-libs' instead of the individual artefacts.
  2. Replace calls to 'model.getWriter("RDF/XML")' with the invocation of the RDFDataManager 'RDFDataMgr.write(outputStream, model, RDFFormat.RDFXML_PLAIN);'.

Copy link
Contributor

Choose a reason for hiding this comment

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

replacing model.getwriter() in the jena-provider project seems to be the proper way to go. If we want to do that, @berezovskyi is arguing that we should do a proper refactoring of the provider classes in the jena-provider project. Do you have the time/effort to do it?
There are many Jax-RS providers that handle XML/RDF. but from my analysis of these classes, they all end up in the AbstractOslcRdfXmlProvider.java class.

The alternative above is the hack because it is based on private classes of Jena (within an adaptor) that gives you the same result, in the short term, without touching Jena-provider.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, I actually did develop a Universal provider but that patch needs more work eclipse/lyo.core#9

Copy link

@jamsden jamsden left a comment

Choose a reason for hiding this comment

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

Should we make these changes in OSLC4J instead?

  1. Depend on 'apache-jena-libs' instead of the individual artefacts.
  2. Replace calls to 'model.getWriter("RDF/XML")' with the invocation of the RDFDataManager 'RDFDataMgr.write(outputStream, model, RDFFormat.RDFXML_PLAIN);'.

@berezovskyi
Copy link
Member Author

berezovskyi commented Feb 6, 2018

Absolutely, we should make the changes to the OSLC4J if we expect the majority of the Lyo users to come in contact with the legacy apps that can't parse all variants of conformant RDF (typed node elements were legit even in RDF 1.0 https://www.w3.org/TR/2004/REC-rdf-syntax-grammar-20040210/#section-Syntax-typed-nodes).

Here is a list of things we need to do:

  • CQ the apache-jena-libs:3.0.1
  • Remove code duplication from AbstractOslcRdfXmlProvider.
    • The reason we need to do that is that the writer.write() is duplicated. See the image below, nothing special.
  • Consolidate the (media type, system prefs) -> (jena format) conversion so that we can manipulate the format cleanly (plain RDF / RDF with typed nodes etc.). Right now we have the following methods:
    • isAcceptableMediaType
    • isCompatible
    • getSerializationLanguage
    • also we have org.eclipse.lyo.oslc4j.alwaysXMLAbbrevOnlyProviders property
  • stop using strings like "RDF/XML" for Jena and use https://jena.apache.org/documentation/javadoc/arq/org/apache/jena/riot/RDFFormat.html

image

@berezovskyi
Copy link
Member Author

But I think that legacy-talking code can either call

ModelFactory.createDefaultModel();
RDFWriterFImpl.alternative(null);

Or we can add a static method in Lyo with these two lines.

@berezovskyi
Copy link
Member Author

I am sorry to write this, but I completely lost the context why did we need to force any kind of Jena model writer?

Also,

  • switch to Jena 2.4.0-SNAPSHOT artifacts

@jamsden
Copy link

jamsden commented Jul 2, 2018

This was required to get the RFD/XML to output a specific format that the jazz-app web applications are expecting.

@berezovskyi
Copy link
Member Author

berezovskyi commented Jul 2, 2018 via email

@jamsden
Copy link

jamsden commented Jul 2, 2018 via email

@berezovskyi
Copy link
Member Author

Do you think you could do that, Jim, please? :)

@berezovskyi
Copy link
Member Author

@jadelkhoury what's the status on this one?

@jadelkhoury
Copy link
Contributor

I don’t think we should be merging branches in this project. The code on master is meant to be generated. So if we want to make changes to the code, this ought to be done in the generator.
I have normally created branches here to experiment or illustrate how the generated code is meant to look like. But once we decide, the change/branch is made in the Lyo.designer repo.

@jadelkhoury
Copy link
Contributor

From what I read above, we should just kill this branch?

@jadelkhoury jadelkhoury deleted the jena3 branch April 23, 2019 20:13
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.

None yet

3 participants