Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Context Object - possible inconsistency with specification #79

Open
GrantBailey opened this issue Oct 17, 2016 · 3 comments
Open

Context Object - possible inconsistency with specification #79

GrantBailey opened this issue Oct 17, 2016 · 3 comments
Labels

Comments

@GrantBailey
Copy link

The xAPI specification's description of the properties of the Context Object (see https://github.com/adlnet/xAPI-Spec/blob/master/xAPI-Data.md#requirements-10) is as follows:

  • The "revision" property MUST only be used if the Statement's Object is an Activity.
  • The "platform" property MUST only be used if the Statement's Object is an Activity.

In apparent contravention of the specification the PHP xAPI library allows the 'revision' and 'platform' properties where the Statement's Object is other than Activity. Example:

$activity = new TinCan\Activity (
[
'id' => 'http://www.baileyandireland.com/tincan/meeting/16-10-16',
'objectType' => 'Agent',
'name' => 'Andrew Downes',
'mbox' => 'mailto:[email protected]'
]
);
$context = new TinCan\Context (
[
'registration' => 'ec531277-b57b-4c15-8d91-d292c5b2b8f7',
'instructor' =>
[
'name' => 'Andrew Downes',
'account' =>
[
'homePage' => 'http://www.example.com',
'name' => '13936749'
],
'objectType' => 'Agent'
],
'team' =>
[
'name' => 'Team PB',
'mbox' => 'mailto:[email protected]',
'objectType' => 'Group'
],
'contextActivities' =>
[
'parent' =>
[
'id' => 'http://www.example.com/meetings/series/267',
'objectType' => 'Activity'
],
'grouping' =>
[
'id' => 'http://example.adlnet.gov/xapi/example/Algebra1'
],
'category' =>
[
'id' => 'http://www.example.com/meetings/categories/teammeeting',
'objectType' => 'Activity',
'definition' =>
[
'name' =>
[
'en-US' => 'team meeting'
],
'description' =>
[
'en-US' => 'A category of meeting used for regular team meetings.'
],
'type' => 'http://example.com/expapi/activities/meetingcategory'
],
],
'other' =>
[
[
'id' => 'http://www.example.com/meetings/occurances/34257',
'objectType' => 'Activity'
],
[
'id' => 'http://www.example.com/meetings/occurances/3425567',
'objectType' => 'Activity'
]
]
],
'revision' => 'Updated in Dec 2015',
'platform' => 'Example virtual meeting software',
'language' => 'en',
'statement' =>
[
'objectType' => 'StatementRef',
'id' => '6690e6c9-3ef0-4ed3-8b37-7f3964730bee'
],
'extensions' =>
[
'http://example.com/profiles/meetings/activitydefinitionextensions/room' =>
[
'name' => 'Kilby',
'id' => 'http://example.com/rooms/342'
]
]
]
);

@garemoko
Copy link
Contributor

You're trying to cast what looks like an agent object (but with an id property) as a TinCan\Activity.

I'm surprised that isn't erroring, but maybe it's just ignoring the properties it doesn't need and simply using the id to build an activity.

$activity = new TinCan\Activity (
[ 
'id' => 'http://www.baileyandireland.com/tincan/meeting/16-10-16',
'objectType' => 'Agent',
'name' => 'Andrew Downes',
'mbox' => 'mailto:[email protected]'
]
);

Try this instead:

$object = new TinCan\Agent (
[ 
'objectType' => 'Agent',
'name' => 'Andrew Downes',
'mbox' => 'mailto:[email protected]'
]
);

@brianjmiller
Copy link
Member

This actually appears to be an issue with semver breakage in the specification between 1.0.0 and 1.0.1.

1.0.0 Version:

The revision property MUST NOT be used if the Statement's Object is an Agent or Group.
The platform property MUST NOT be used if the Statement's Object is an Agent or Group.

1.0.1+ Version:

The revision property MUST only be used if the Statement's Object is an Activity.
The platform property MUST only be used if the Statement's Object is an Activity.

Not that it will necessarily matter for this lib. In general the library doesn't do any validation of objects leaving that to the LRS, but I could in this case see us checking during Statement serialization whether those properties exist/should be included in the Context.

@GrantBailey
Copy link
Author

Andrew, Brian:
Thanks once again for the clarifications. Hopefully I will be on the right track now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants