How to save/restore in Json and monitor for changes


#1

Hi

I have designed a web-based card game that I would like to implement in Solid. Every player would have a solid account and one player is designated the ‘Host’ for any specific game - the details of the state of the game to be saved in this user’s POD. I am looking to use a simple enough method for storing a game. The game would have an initial state which could be stored as a Json string and then a series of ‘Actions’ that are applied to the game. Each action is basically an array of integers. An action is applied by a particular user and would need to propagate to all current users in the game. So this leaves me with two questions:

  1. How would I save/restore the json string for the initial state of a game in a user’s POD using rdflib?

  2. Can I store the list of actions in an ordered sequence such that I can use the UpdateManager so all users are notified of new actions being added?

Thanks
Des


#2

If you store them as plain JSON, you’re not storing them as RDF, so rdflib doesn’t really make a lot of sense. If you want to use e.g. rdflib’s UpdateManager and be notified of new data being added, you might want to consider storing your data as RDF. Thus, the best course of action is probably to learn about how to do that.


#3

To start with I don’t know how to store Json in a user’s Solid POD. Can someone please explain how I would do that or at least point me to the relevant documentation?


#4

You’d store JSON in the same way as you’d store other non-RDF data, like images. I’m not sure if there’s good documentation on that somewhere, but basically it comes down to doing a regular POST request with the data using solid-auth-client, as far as I’m aware (though I haven’t done it myself).

Potentially an easier interface on top of that might be @jeffz’s solid-file-client, which I’m sure he’ll be happy to further guide you with :slight_smile:

(Of course, note the caveats on using JSON I mentioned earlier.)


#5

When developing, you can manually store / edit your json with File Manager Solid file manager . With your app, @jeffz solid-file-client is what you need


#6

If you are familiar with JSON, you could store it as JSON-LD.

I’m wondering if you might opt to save as json (but with the Linked Data properties that offers).

PS: I’m not an expert on this topic, but might be of your interest…