Skip to content

Instantly share code, notes, and snippets.

@dret
Created February 6, 2015 23:24
Show Gist options
  • Save dret/95a483be2f8535f18d7c to your computer and use it in GitHub Desktop.
Save dret/95a483be2f8535f18d7c to your computer and use it in GitHub Desktop.
JSON-only AS
{
"published": "2015-01-06T15:04:55Z",
"startTime": "2015-01-05T17:33:40Z",
"endTime": "2015-01-05T19:08:39Z",
"status": "completed",
"actor": {
"objectType" : "person",
"id": "http://dret.net/netdret/",
"displayName": "Erik Wilde"
},
"verb": "exercise",
"exerciseType": {
"vocabulary": "https://github.com/dret/exercise#strava-v3.md",
"type": "Ride"
},
"exerciseData": [ "HRM", "Geo", "AirTemp" , "Time" ],
"object" : {
"objectType":"exercise",
"title": "Bishop Eastside",
"id": "http://www.strava.com/activities/237180070",
"url": "http://www.strava.com/activities/237180070/export_gpx"
}
}
}
@dret
Copy link
Author

dret commented Feb 6, 2015

@elf-pavlik: you were asking how to be able to have "activity subtypes" in AS without depending on RDFS and inference. this example here is from dret/exercise#1 and a rough idea. also, keep in mind that it's AS1 which by definition is JSON only. what you see here is that we use a verb "exercise" (the activity type), and we also "subtype" this with exerciseType (and we're thinking about making this mechanism reusable, i.e. to not make it specific for a verb).
in this case, what the AS tells you that this is (a) an "exercise" activity, and (b) that this specific "exercise" activity also is a "ride" according to a vocabulary created by strava.
why we use this design is because now on the JSON level it is clearly visible that this is an exercise, so any consumer looking for "exercise" activities will recognize it. this also is marked as something more specific (a "ride"), and anybody caring about this more specific information can use it, if they like. no out-of-band information required, everything self-contained and self-describing.
i am sure that you have issues with parts of this design and so have i, and as i said, it's work in progress. but you were wondering how this would be possible without RDFS inference, and i wanted to show you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment