Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "Org.eclipse.higgins.js.pds.client API usage example"
(→Execution) |
(→NYTimes template) |
||
Line 13: | Line 13: | ||
a owl:Class ; | a owl:Class ; | ||
rdfs:subClassOf <http://www.eclipse.org/higgins/ontologies/2010/6/higgins#Person> ; | rdfs:subClassOf <http://www.eclipse.org/higgins/ontologies/2010/6/higgins#Person> ; | ||
+ | rule #1: | ||
map:nameRule | map:nameRule | ||
[ a map:roleSameAs ; | [ a map:roleSameAs ; | ||
Line 20: | Line 21: | ||
map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Buyer> | map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Buyer> | ||
] ; | ] ; | ||
+ | rule #2: | ||
map:telephoneRule | map:telephoneRule | ||
[ a map:roleSameAs ; | [ a map:roleSameAs ; |
Revision as of 21:14, 19 September 2011
{{#eclipseproject:technology.higgins|eclipse_custom_style.css}}
Contents
Initial State
Contexts
NYTimes template
The template context http://azigo.com/sys/templates/nytimes.com contains (among other things) the following mapping rules:
:NYTimesPerson a owl:Class ; rdfs:subClassOf <http://www.eclipse.org/higgins/ontologies/2010/6/higgins#Person> ;
rule #1:
map:nameRule [ a map:roleSameAs ; map:equivalentAttribute fp:givenName ; map:predicate :bFirstName ; map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Buyer> ] ;
rule #2:
map:telephoneRule [ a map:roleSameAs ; map:equivalentAttribute fp:phone ; map:predicate :phone ; map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Ecommerce> ] .
call getAttributes() 1st time
Call
Example call to getAttributes (domain, audience, attributes[], where[], future)
- atts[0] := (http://nytimes#phone, false, nil) // a phone number
- atts[1] := (http://nytimes#bFirstName, false, nil) // "billing first name"
- getAttributes ("nytimes.com", nil, atts, nil, nil)
Execution
- context := getConnectionContext ()
- result: context == http://azigo.com/ptrevithick/nytimes.com)
- call findRoles()
- result:
- ((p:eCommerce, (nytimes.com#bFirstName, nil, nil))
- (p:Buyer, (nytimes.com#phone, nil, nil)))
- result:
- call sortByRole()
- result:
- ((p:eCommerce, (nytimes.com#bFirstName, nil, nil))
- (p:Buyer, (nytimes.com#phone, nil, nil)))
- result:
- Try to pull attributes from #me person in the nytimes.com
- result: no result: the nytimes.com context doesn't yet exist
- Try to pull attributes from #me person in root context
- call findPersonByRole()
- result: nil (no persons found that match role)
- result: no attribute/values found
call setAttributes() 1st time
Call
Example call to setAttributes (domain, attributes[])
- atts[0] := (http://nytimes#bFirstName, false, nil) // "billing first name"
- atts[1] := (http://nytimes#phone, false, nil) // a phone number
- setAttributes ("nytimes.com", atts[])
Execution
- context := getConnectionContext ()
- result: context == http://azigo.com/ptrevithick/nytimes.com
- template := getConnectionTemplate
- result: template == http://azigo.com/sys/template/nytimes.com
- Loop(0): p=(http://nytimes.com#bFirstName, "Alice")
- class := getNamespace(http://nytimes.com#bFirstName)
- result: class == http://nytimes.com
- att := getLocalAtt (http://nytimes.com#bFirstName)
- result: att == "bFirstName"
- rule := getRule (template=http://azigo.com/sys/template/nytimes.com, class=http://nytimes.com, att="bFirstName")
- result: rule :=
- newPerson := pushEvalRule (context=http://azigo.com/ptrevithick/nytimes.com, rule, value="Alice")
- result: a new Person node named "#me" ...
- class := getNamespace(http://nytimes.com#bFirstName)