Last active
July 29, 2018 03:24
-
-
Save rubysoho07/393057852a1457fb7d826ae3d21cf2c5 to your computer and use it in GitHub Desktop.
Caliper Example 1. Actor, Action, Object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from caliper import entities | |
# actor: 'Subject' part of an Event | |
actor = entities.Person( | |
id='http://example.org/person/123', | |
name='Test' | |
) | |
print(actor.as_json(thin_context=True, thin_props=True)) | |
# Result: {"@context": "http://purl.imsglobal.org/ctx/caliper/v1p1", "id": "http://example.org/person/123", "name": "Test", "type": "Person"} | |
# action: 'Verb' part of an Event | |
from caliper.constants import CALIPER_ACTIONS | |
action = CALIPER_ACTIONS['LOGGED_IN'] | |
print(action) | |
# Result: LoggedIn | |
# object: 'Object' part of an Event | |
obj = entities.SoftwareApplication( | |
id='http://example.org/app/testservice', | |
name='Learning Analytics Example' | |
) | |
print(obj.as_json(thin_context=True, thin_props=True)) | |
# Result: | |
""" | |
{ | |
"@context":"http://purl.imsglobal.org/ctx/caliper/v1p1", | |
"id":"http://example.org/app/testservice", | |
"name":"Learning Analytics Example", | |
"type":"SoftwareApplication" | |
} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment