Skip to main content

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.

Jump to: navigation, search

Difference between revisions of "Org.eclipse.higgins.js.pds.client API usage example"

(call getAttributes() 1st time)
Line 1: Line 1:
 
{{#eclipseproject:technology.higgins|eclipse_custom_style.css}}
 
{{#eclipseproject:technology.higgins|eclipse_custom_style.css}}
 +
 +
We show an example of calling getAttributes, calling setAttributes and then calling getAttributes a second time. In all cases we read/write the same two attributes in the nytimes.com namespace, bFirstName and phone.
  
 
==Initial State==
 
==Initial State==

Revision as of 22:07, 19 September 2011

{{#eclipseproject:technology.higgins|eclipse_custom_style.css}}

We show an example of calling getAttributes, calling setAttributes and then calling getAttributes a second time. In all cases we read/write the same two attributes in the nytimes.com namespace, bFirstName and phone.

Initial State

Contexts

Pdsclient example 2.0.101.png

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()

Call

Example call to getAttributes (domain, audience, attributes[], where[], future)

Execution

  • context := getConnectionContext ()
  • call findRoles()
    • result:
      • ((p:eCommerce, (nytimes.com#bFirstName, nil, nil))
      • (p:Buyer, (nytimes.com#phone, nil, nil)))
  • call sortByRole()
    • result:
      • ((p:eCommerce, (nytimes.com#bFirstName, nil, nil))
      • (p:Buyer, (nytimes.com#phone, nil, nil)))
  • 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()

Call

Example call to setAttributes (domain, attributes[])

Execution

pushEvalRule (context=http://azigo.com/ptrevithick/nytimes.com, rule, value="Alice") Execution

Back to the top