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())
(Execution)
Line 90: Line 90:
 
** result: attributes[] == (http://nytimes.com#gender, http://nytimes.com#bFirstName)
 
** result: attributes[] == (http://nytimes.com#gender, http://nytimes.com#bFirstName)
 
* rolesAtts[] := findRoles()
 
* rolesAtts[] := findRoles()
** result: rolesAtts[] == ((p:Byer, http://nytimes.com#bFirstName), (p:Ecommerce, http://nytimes.com#gender))
+
** result: rolesAtts[] == ((p:Ecommerce, http://nytimes.com#gender), (p:Buyer, http://nytimes.com#bFirstName))
 
* sortByRole
 
* sortByRole
** result: rolesAtts[] == ((p:Byer, http://nytimes.com#bFirstName), (p:Ecommerce, http://nytimes.com#gender))
+
** result: rolesAtts[] == ((p:Ecommerce, http://nytimes.com#gender), (p:Buyer, http://nytimes.com#bFirstName))
 
* person := http://azigo.com/ptrevithick/nytimes.com#me
 
* person := http://azigo.com/ptrevithick/nytimes.com#me
 
* Since ''person'' doesn't exist we create the statements:
 
* Since ''person'' doesn't exist we create the statements:
Line 110: Line 110:
 
*** rule := getRule (template=http://azigo.com/sys/template/nytimes.com, class=http://nytimes.com, att="gender")
 
*** rule := getRule (template=http://azigo.com/sys/template/nytimes.com, class=http://nytimes.com, att="gender")
 
**** result rule==(see "rule #2" in Initial State section above)
 
**** result rule==(see "rule #2" in Initial State section above)
*** '''pushEvalRule'''(person=:me, rule, value[0]="female")
+
*** '''pushEvalRule'''(person=:me, rule #2 above, value[0]="female")
 
** EndLoop
 
** EndLoop
 
* Loop[1] ra==(p:Buyer, http://nytimes.com#bFirstName)  
 
* Loop[1] ra==(p:Buyer, http://nytimes.com#bFirstName)  
Line 126: Line 126:
 
*** rule := getRule (template=http://azigo.com/sys/template/nytimes.com, class=http://nytimes.com, att="bFirstName")
 
*** rule := getRule (template=http://azigo.com/sys/template/nytimes.com, class=http://nytimes.com, att="bFirstName")
 
**** result rule==(see "rule #1" in Initial State section above)
 
**** result rule==(see "rule #1" in Initial State section above)
*** '''pushEvalRule'''(person=<new person>, rule, value[0]="Alice")
+
*** '''pushEvalRule'''(person=<new person>, rule #1 above, value[0]="Alice")
 
** EndLoop
 
** EndLoop
 
* EndLoop
 
* EndLoop
 
* Loop for every person np in newPersons[]
 
* Loop for every person np in newPersons[]
 
** result: add an h:correlation link from :me to <new person>
 
** result: add an h:correlation link from :me to <new person>
 +
 +
==== 0:pushEvalRule (:me, rule #2 above, "female") ====
 +
 +
==== 1:pushEvalRule (<new person>, rule #2 above, "Alice") ====
  
 
== Final State ==
 
== Final State ==
 
Red is newly created context
 
Red is newly created context
 
[[Image:Pdsclient api final state 2.0.105.png|center]]
 
[[Image:Pdsclient api final state 2.0.105.png|center]]

Revision as of 14:45, 20 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) a class named "http://nytimes.com" that has 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:rolePathLiteral ;
               map:mappedAtt <http://www.w3.org/2006/vcard/ns#given-name> ;
               map:path <http://www.w3.org/2006/vcard/ns#n> ;
               map:predicate :bFirstName ;
               map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Buyer>
             ] ;

rule #2:

     map:relationshipsRule
             [ a       map:roleSameAs ;
               map:equivalentAttribute
                       fp:gender ;
               map:predicate :gender ;
               map:role <http://www.eclipse.org/higgins/ontologies/2010/6/persona#Ecommerce>
             ] ;

Flat Person (relevant sections only)

     map:relationshipsRule
             [ rdf:type map:roleLiteral ;
               map:mappedAtt <http://xmlns.com/foaf/0.1/gender> ;
               map:predicate :gender ;
               map:role map:roleParam
             ] .

call getAttributes()

Call

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

Execution

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

  • setAttributes ("nytimes.com", attvals[])

Execution

0:pushEvalRule (:me, rule #2 above, "female")

1:pushEvalRule (<new person>, rule #2 above, "Alice")

Final State

Red is newly created context

Pdsclient api final state 2.0.105.png

Back to the top