-
Notifications
You must be signed in to change notification settings - Fork 0
Parameter Object Functions
Red One edited this page Feb 13, 2018
·
1 revision
- setActorByMbox(name,mbox);
- setActorByMboxSha1sum(name,mbox_sha1sum);
- setActorByOpenid(name,openid);
- setActorByAccount(name,homePage,accountName);
- setVerb(id,display);
- setDisplay(language1,value1,...,languageN,valueN);
- setObject(id,definition);
- setDefinition(name,description,type,extensions,interactionType,correctResponsesPattern,choices);
- setName(language1,value1,...,languageN,valueN);
- setDescription(language1,value1,...,languageN,valueN);
- setExtensions(extension1,...,extensionN);
- setCorrectResponsesPattern(pattern1,...,patternN);
- setChoices(id1,description1,...,idN,descriptionN);
- setResult(duration,extensions,response,score,success);
- setScore(min,raw,max);
- setContext(instructor,language,contextActivities,platform,extensions);
- setInstructorByMbox(name,mbox);
- setInstructorByMboxSha1sum(name,mbox_sha1sum);
- setInstructorByOpenid(name,openid);
- setInstructorByAccount(name,homePage,accountName);
- setContextActivities(parent,group,category);
- setParent(id1,definition1,...,idN,definitionN);
- setCategory(id1,...,idN);
- setAuthorityByMbox(name,mbox);
- setAuthorityByMboxSha1sum(name,mbox_sha1sum);
- setAuthorityByOpenid(name,openid);
- setAuthorityByAccount(name,homePage,accountName);
- setTimestamp();
- Description: Actor set by the mbox.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| mbox | mailto IRI | The required format is "mailto:email address". Only email addresses that have only ever been and will ever be assigned to this Agent, but no others, should be used for this property and mbox_sha1sum. |
var actor = visca.setActorByMbox("Crystal","mailto:crystal@visca.com");- Description: Actor set by the mbox_sha1sum.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| mbox_sha1sum | mailto IRI | The SHA1 hash of a mailto IRI (i.e. the value of an mbox property). An LRS MAY include Agents with a matching hash when a request is based on an mbox. |
var actor = visca.setActorByMboxSha1sum("Crystal","mailto:crystal@visca.com");{
"objectType": "Agent",
"name": "Crystal",
"mbox_sha1sum": "0e2b882ae30d010c80e93d2cbd134076d8e1fad3"
}- Description: Actor set by the openid.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| openid | URI | An openID that uniquely identifies the Agent. |
var actor = visca.setActorByOpenid("Crystal","http://crystal.openid.example.org/");- Description: Actor set by the account.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| homePage | IRL | The canonical home page for the system the account is on. This is based on FOAF's accountServiceHomePage. |
| accountName | String | The unique id or name used to log in to this account. This is based on FOAF's accountName. |
var actor = visca.setActorByAccount("Crystal","https://auth.ischool.com.tw/","f9e2t55c-7451-4d0b-ac3r-7201q1a6dfgf");- Description: Set up verb.
- Parameters:
| Name | Type | Description |
|---|---|---|
| id | URL | Corresponds to a Verb definition. Each Verb definition corresponds to the meaning of a Verb, not the word. The IRI should be human-readable and contain the Verb meaning. |
| display | Object | The human readable representation of the Verb in one or more languages. This does not have any impact on the meaning of the Statement, but serves to give a human-readable display of the meaning already determined by the chosen Verb. |
var id = "https://w3id.org/xapi/acrossx/verbs/watched";
var display = visca.setDisplay("zh-TW","觀看");
var verb = visca.setVerb(id,display);- Description: Set up a multi-language display.
- Parameters:
| Name | Type | Description |
|---|---|---|
| language | String | Language code |
| value | String | Display content |
var display = visca.setDisplay("zh-TW","跳過");var display = visca.setDisplay("zh-TW","跳過","en-US","skipped");- Description: Set up object.
- Parameters:
| Name | Type | Description |
|---|---|---|
| id | IRI | An identifier for a single unique Activity. |
| definition | Object | Metadata. |
var id = "https://www.youtube.com/watch?v=sQcwRGTW5mw";
var name = visca.setName("zh-TW","Future Learning");
var description = visca.setDescription("zh-TW","【親子天下】《翻轉教育:未來教育 Future Learning》");
var type = "https://w3id.org/xapi/acrossx/activities/video";
var extensions = visca.setExtension("duration","PT12M47S");
var definition = visca.setDefinition(name,description,type,extensions,null,null,null);
var object = visca.setObject(id,definition);- Description: Set up metadata.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | Object | The human readable/visual name of the Activity. |
| description | Object | A description of the Activity. |
| type | URL | The type of Activity. |
| extensions | Object | A map of other properties as needed. |
| interactionType | String | As in "cmi.interactions.n.type" as defined in the SCORM 2004 4th Edition Run-Time Environment. |
| correctResponsesPattern | Array of Strings | Corresponds to "cmi.interactions.n.correct_responses.n.pattern" as defined in the SCORM 2004 4th Edition Run-Time Environment, where the final n is the index of the array. |
| choices | Array of Objects | Specific to the given interactionType. |
var name = visca.setName("zh-TW","1");
var description = visca.setDescription("zh-TW","哪一個人最帥?");
var type = "http://adlnet.gov/expapi/activities/cmi.interaction";
var interactionType = "choice";
var correctResponsesPattern = visca.setCorrectResponsesPattern("king");
var id1 = "king";
var king = visca.setDescription("zh-TW","金城武");
var id2 = "ming";
var ming = visca.setDescription("zh-TW","明金城");
var choices = visca.setChoices(id1,king,id2,ming);
var definition = visca.setDefinition(name,description,type,extensions,interactionType,correctResponsesPattern,choices);- Description:Set up name.
- Parameters:
| Name | Type | Description |
|---|---|---|
| language | String | Language code |
| value | String | Display content |
var name = visca.setName("zh-TW","《老人與海》");- Description: Set up description.
- Parameters:
| Name | Type | Description |
|---|---|---|
| language | String | Language code |
| value | String | Display content |
var description = visca.setDescription("zh-TW","作者是海明威");- Description: Set up the extension.
- Parameters:
| Name | Type | Description |
|---|---|---|
| key | String | Additional category name |
| value | String/Activity Object/URL/Integer/ISO 8601 String/Array of String | Additional content |
var bloomsLevel = visca.setExtension("blooms-level","Applying");var page = visca.setExtension("page",8);var browserInfo = visca.setExtension("browser-info");- Description: Set up extensions.
- Parameters:
| Name | Type | Description |
|---|---|---|
| extension | Object | Set up additional JSON object |
var alignment = visca.setExtension("alignment",["社4-4-2-4","語1-1-2-2"]);
var duration = visca.setExtension("duration","PT12M47S");
var extensions = visca.setExtensions(alignment,duration);- Description: Set up the correct responses pattern.
- Parameters:
| Name | Type | Description |
|---|---|---|
| pattern | String | Correct answer |
var correctResponsesPattern = visca.setCorrectResponsesPattern("king");- Description: Set up choices.
- Parameters:
| Name | Type | Description |
|---|---|---|
| id | String | Option ID |
| description | Object | Description of content option. |
var id1 = "king";
var king = visca.setDescription("zh-TW","金城武");
var id2 = "ming";
var ming = visca.setDescription("zh-TW","明金城");
var choices = visca.setChoices(id1,king,id2,ming);- Description: Set up result.
- Parameters:
| Name | Type | Description |
|---|---|---|
| duration | ISO 8601 String | Period of time over which the Statement occurred. |
| extensions | Object | A map of other properties as needed. |
| response | String | A response appropriately formatted for the given Activity. |
| score | Object | The score of the Agent in relation to the success or quality of the experience. |
| success | Boolean | Indicates whether or not the attempt on the Activity was successful. |
var duration = "PT20S";
var extensions = null;
var response = "king";
var score = visca.setScore(0,10,10);
var success = true;
var result = visca.setResult(duration,extensions,response,score,success);- Description: Set up score.
- Parameters:
| Name | Type | Description |
|---|---|---|
| min | Decimal number less than max | Cf. 'cmi.score.min' |
| raw | Decimal number between min and max | Cf. 'cmi.score.raw' |
| max | Decimal number greater than min | Cf. 'cmi.score.max' |
var score = visca.setScore(0,10,10);- Description: Set up context.
- Parameters:
| Name | Type | Description |
|---|---|---|
| instructor | Agent Object | Instructor that the Statement relates to, if not included as the Actor of the Statement. |
| language | String | Code representing the language in which the experience being recorded in this Statement (mainly) occurred in, if applicable and known. |
| contextActivities | Object | Context type of information |
| platform | String | Platform used in the experience of this learning activity. |
| extensions | Object | A map of any other domain-specific context relevant to this Statement. For example, in a flight simulator altitude, airspeed, wind, attitude, GPS coordinates might all be relevant. |
var instructor = visca.setInstructorByMbox("Crystal","mailto:crystal@visca.com");
var language = "zh-TW";
var contextActivities = visca.setContextActivities();
var context = visca.setContext(instructor);- Description: Instructor set by the mbox.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| mbox | mailto IRI | The required format is "mailto:email address". Only email addresses that have only ever been and will ever be assigned to this Agent, but no others, should be used for this property and mbox_sha1sum. |
var instructor = visca.setInstructorByMbox("Crystal","mailto:crystal@visca.com");- Description: Instructor set by the mbox_sha1sum.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| mbox_sha1sum | mailto IRI | The SHA1 hash of a mailto IRI (i.e. the value of an mbox property). An LRS MAY include Agents with a matching hash when a request is based on an mbox. |
var instructor = visca.setInstructorByMboxSha1sum("Crystal","mailto:crystal@visca.com");{
"objectType": "Agent",
"name": "Crystal",
"mbox_sha1sum": "0e2b882ae30d010c80e93d2cbd134076d8e1fad3"
}- Description: Instructor set by the openid.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| openid | URI | An openID that uniquely identifies the Agent. |
var instructor = visca.setInstructorByOpenid("Crystal","http://crystal.openid.example.org/");- Description: Instructor set by the account.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| homePage | IRI | The canonical home page for the system the account is on. This is based on FOAF's accountServiceHomePage. |
| accountName | String | The unique id or name used to log in to this account. This is based on FOAF's accountName. |
var instructor = visca.setInstructorByAccount("Crystal","https://auth.ischool.com.tw/","f9e2t55c-7451-4d0b-ac3r-7201q1a6dfgf");- Description: Setting the type of activity context information.
- Parameters:
| Name | Type | Description |
|---|---|---|
| parent | Object | Parent activity |
| group | ||
| category | Object | Profile ID Activity |
var id = "http://www.visca.com/plan/id/1";
var name = visca.setName("zh-TW","我的學習計畫");
var type = "https://w3id.org/xapi/acrossx/activities/learning-plan";
var definition = visca.setDefinition(name,null,type,null,null,null,null);
var parent = visca.setParent(id,definition);
var category = visca.setCategory("https://w3id.org/xapi/acrossx/profile/video");
var contextActivities = visca.setContextActivities(parent,null,category);- Description:Set up a parent activity.
- Parameters:
| Name | Type | Description |
|---|---|---|
| id | IRI | An identifier for a single unique Activity |
| definition | Object | Metadata |
var id = "https://www.youtube.com/watch?v=sQcwRGTW5mw";
var name = visca.setName("zh-TW","Future Learning");
var type = "https://w3id.org/xapi/acrossx/activities/video";
var extensions = visca.setExtension("duration","PT12M47S");
var definition = visca.setDefinition(name,null,type,extensions,null,null,null);
var parent = visca.setParent(id,definition);- Description: Set up profile ID activity.
- Parameters:
| Name | Type | Description |
|---|---|---|
| id | URL | Profile ID Activity |
var category = visca.setCategory("https://w3id.org/xapi/acrossx/profile/video");var category = visca.setCategory("https://w3id.org/xapi/acrossx/profile/practice","https://w3id.org/xapi/acrossx/profile/ebook");- Description: Use mbox to set owner.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name |
| mbox | mailto IRI | The required format is "mailto:email address". Only email addresses that have only ever been and will ever be assigned to this Agent, but no others, should be used for this property and mbox_sha1sum. |
var authority = visca.setAuthorityByMbox("Teacher","mailto:teacher@visca.com");- Description: Use mbox_sha1sum to set owner.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name |
| mbox_sha1sum | mailto IRI | The SHA1 hash of a mailto IRI (i.e. the value of an mbox property). An LRS MAY include Agents with a matching hash when a request is based on an mbox. |
var authority = visca.setAuthorityByMboxSha1sum("Teacher","mailto:teacher@visca.com");{
"objectType": "Agent",
"name": "Teacher",
"mbox_sha1sum": "e81c473d8eb3d276bd7d696adfe9c8275b3969ae"
}- Description: Use openid to set owner.
- Parameters:
| Name | Type | Description |
|---|---|---|
| name | String | Full name of the authority. |
| openid | URI | An openID that uniquely identifies the agent. |
var authority = visca.setAuthorityByOpenid("Teacher","http://teacher.openid.example.org/");- Description: Use account to set owner.
- Parameters:
var authority = visca.setAuthorityByAccount("Teacher","http://www.example.com","13936749");| Name | Type | Description |
|---|---|---|
| name | String | Full name of the Agent. |
| homePage | IRI | The canonical home page for the system the account is on. This is based on FOAF's accountServiceHomePage. |
| accountName | String | The unique id or name used to log in to this account. This is based on FOAF's accountName. |
- Description: set time stamp.
- Parameters: no.
- Return:Format [YYYY]-[MM]-[DD]T[hh]:[mm]:[ss.sss]Z of ISO String
var timestamp = visca.setTimestamp();