How would I use Solid in a Java/Scala application

I’m more aware of things done in Javascript but, there is no reason you couldn’t use a different RDF parsing library.

1 Like

As Jeffz said, there is no reason for non being able to use other RDF libraries. Besides Jena and Sesame, there is also banana-rdf: https://github.com/banana-rdf/banana-rdf/blob/series/0.8.x/README.md. banana-rdf is a pure Scala implementation. I haven’t use it jet, but I would give it a try.

1 Like

Great will check it out. Tx

I have looked at all available options and I would have no idea where to start in terms of connecting the authentication done via solid-auth-cli and then doing RDF manipulation via something like Jena. So until there’s better tools available Solid is a non-starter for my project, which is a shame.

You could use the WebView (Android.webkit.WebView; javafx.scene.web.WebView) to handle the login and the session. That would mean that whenever the Java Session Instance is invoked, it returns the session object from the WebView’s local storage (key=solid-auth-client). Further, you can either run your HTTP Request through the solid-auth-client or otherwise make sure that the Java HTTP Client sets the required HTTP Header Fields correctly. I ran some commands with curl a while ago, and the only Header Field I had to set was “Cookie: nssidp.sid=the-sessio-id”.

This approach should also work on Android. I think Microsoft is doing something similar with their Android Skype and Outlook app.

Yes the plan was to use a WebView to get the login part taken care of but figuring what to do after is where I came undone. I had no idea how to use the session key to authenticate with something like Jena. But that gives me a path forward now. Thank you.

1 Like

Glad I could help :blush:. Good luck with that.

I checked out banana-rdf as suggested. The one drawback I found is that it seems I cannot use turtle/text on the scalajs side as there seems to be no Reader/Writer available for turtle.

I’ve posted a question on stackoverflow

1 Like

Hi @hughgearse! Yes, you can interface with Solid pods using Java or Scala, or any mainstream language. (For example, I know of at least one Solid server being implemented in Java right now, and I imagine that team will be publishing a Java client at some point.)

But here are the basic building blocks that a non-javascript library would need, to interface with Solid:

  1. OpenID Connect client for a traditional OAuth2/OIDC use case. Where you’d be writing to a user’s pod on behalf of a user. Most mainstream languages have an OAuth2/OIDC client library, including Java/Scala.
  2. For the Solid-specific social use case, where one application would want to read and write to /multiple/ pods on behalf of a user, you would need a combination OpenID Connect library and a JWT/JWS library able to do digital signatures needed for Proof of Possession operations.
  3. You need some sort of “fetch data over HTTP” library. (Again, pretty much all programming languages have that.)
  4. You need an RDF parser library. (Apache Jena is a fine choice for Java/Scale.)

Does that make sense?

1 Like