Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [rdf4j-dev] Java object as a "view" on a sail



On Tue, Sep 29, 2020 at 8:02 PM Jeen Broekstra <jeen@xxxxxxxxxxxx> wrote:
I have experiences, but nothing really good, to be honest.  In my opinion, OO mappers (whether for RDF or for relational databases) always seem like a good idea and initially help you write code more easily, but in any sufficiently mature project they quickly become a performance burden and a flexibility bottleneck. Whether it's Rails ActiveRecord, Python SQLAlchemy ORM or Java's Hibernate, or any of them really.  So I'm not a fan, personally, I much prefer using a good DSL. 

That said: I realize others may feel differently, so I certainly wouldn't object to such a thing being created or used by others. There used to be a dedicated OO mapper for RDF4J (or rather Sesame) called Alibaba. It was not part of the code migration to Eclipse (the ownership was a bit murky and I didn't want to complicate our migration path) and has not been maintained since then, but it was a nice bit of software (also came with a OWL-> Java code generator  if I remember correctly).  Still can find it on bitbucket (https://bitbucket.org/openrdf/alibaba/src/master/) if you're interested.

I also briefly toyed with the idea of having a proper JPA-compatible implementation for RDF4J. If we ever do find the hands and minds to put effort into an OO mapper, that would be my preferred route as it gives us the widest possible adoption path for Java developers new to RDF.

While Empire [1] is bit rotted, it may be a decent place to start. It at least covers some of the basics of JPA, though I punted on the obviously relational aspects. I'd love for it to get a new life.

 

Cheers,

Jeen

On Mon, Sep 28, 2020, at 16:47, Håvard Ottestad wrote:
Hi,

I’ve been thinking about the way that spring gives you a java object representing parts of your database that can be used more easily then a bunch of queries and is easier to commit back to the database.

I was wondering if anyone has any good experience with anything similar with RDF4J.

I’ve used Pinto before, but it was annoying to have to write the code to retrieve the model and then commit it back again.

What I would like to achieve is to have a method that retrieves a java object, that can be modified and then committed with transactional support. Where annotations on the object tells the underlying implementation what part of the graph to retrieve. 

So I could do.

Person p1 = repo.getPersonById(1);
p1.setName(“person 1”);
p1.commit();  // or repo.commit(p1);

The reason why I’m posting to the RDF4J dev mailing list is because I would like to write some documentation for how do this with RDF4J. So that when people ask me how to get started with graph and rdf I can point them to this simple “java-esque” way of doing it and show them that they don’t even need to learn SPARQL to get started.

Cheers,
Håvard


_______________________________________________
rdf4j-dev mailing list
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/rdf4j-dev


_______________________________________________
rdf4j-dev mailing list
rdf4j-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/rdf4j-dev

Back to the top