Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Mapping vocabulary"

(rolePathLiteral (role, path, mappedAtt))
(PersonGetPDSAccountEmail (mappedAtt))
 
(13 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
The so-called '''body''' of a spin:Template is supposed to contain an RDF representation of a set of SPARQL statements that, when interpreted, compute the value of the function (and potentially have other side effects). In the mapping vocabulary these bodies are empty since we don't presume the existence of a SPARQL interpreter. Thus implementations of these functions must be pre-compiled in some local language (Javascript, Java, etc.)
 
The so-called '''body''' of a spin:Template is supposed to contain an RDF representation of a set of SPARQL statements that, when interpreted, compute the value of the function (and potentially have other side effects). In the mapping vocabulary these bodies are empty since we don't presume the existence of a SPARQL interpreter. Thus implementations of these functions must be pre-compiled in some local language (Javascript, Java, etc.)
  
=== PersonGetAttributeFromList (''mappedAtt, className, [role]'')===
+
 
Start with current person that meets the criteria influenced by the optional ''role'' argument. Return the rdfs:label attribute of the entity the value of whose ''p:id'' attribute equals the stringified value of the number-valued ''mappedAtt'' attribute of the person. The entity in question is an instance of ListDiscreteRange subclass ''className''. Instances of ListDiscreteRange all have ''p:id'' attributes whose values are the cardinality of that entity relative to other entity instances of the class.
+
 
 +
=== PersonGetAttributeFromList (''mappedAtt, discreteRange, [role]'')===
 +
Start with current person that meets the criteria influenced by the optional ''role'' argument. Return the rdfs:label attribute of the entity the value of whose ''p:id'' attribute equals the stringified value of the number-valued ''mappedAtt'' attribute of the person. The entity in question is an instance of DiscreteRange subclass ''discreteRange''. These instances of all have ''p:id'' attributes whose values are the cardinality of that entity relative to other entity instances of the class (through inference this makes them instances of ListDiscreteRange--a subclass of DiscreteRange).  
  
 
Examples:
 
Examples:
Line 38: Line 40:
 
* numberDaughters = PersonGetAttributeNumberWithBounds (''p:numGirls, 0, 10, null'')
 
* numberDaughters = PersonGetAttributeNumberWithBounds (''p:numGirls, 0, 10, null'')
  
===(integer) roleAge (''role'') ===
+
=== PersonGetAttributeWhereValuesHaveAttributeOfValue (''path, valueAtt, val, [role]'')===
From current person lookup the literal value of vcard:bday attribute. Function value is age in years based on current dateTime.
+
Start with current person that meets the criteria influenced by the optional ''role'' argument. Return the set of values of its entity-valued ''path'' attribute where each entity value has an attribute ''valueAtt'' whose value set includes ''val''.
  
 
Example:
 
Example:
* fp:age = roleAge()
+
* fp:buyer = PersonGetAttributeWhereValuesHaveAttributeOfValue (higgins:correlation, p:role, p:Buyer)
  
=== PersonGetPDSAccountEmail (''mappedAtt'') ===
+
=== PersonGetAttributePDSAccountEmail (''mappedAtt'') ===
  
 
A special mapping function that returns the string email address that is the userid of their account on the PDS itself. For example, if Azigo was hosting the PDS then this might return the string "paul@azigo.com" It must be called with mappedAtt = p:pdsAccountEmail.
 
A special mapping function that returns the string email address that is the userid of their account on the PDS itself. For example, if Azigo was hosting the PDS then this might return the string "paul@azigo.com" It must be called with mappedAtt = p:pdsAccountEmail.
  
 
Example:
 
Example:
* userEmail = PersonGetPDSAccountEmail(p:pdsAccountEmail)
+
* userEmail = PersonGetAttributePDSAccountEmail(p:pdsAccountEmail)
 +
 
 +
===PersonGetPersonsWithAttribute (''mappedAtt'') ===
 +
 
 +
Starting with the root person in a context, return the set of all p:Person entities reachable via h:correlation links where each has the attribute mappedAtt.
 +
 
 +
Example
 +
*  personsWithAddresses = PersonGetPersonsWithAttribute (vcard:adr)
 +
 
 +
===(integer) roleAge (''role'') ===
 +
From current person lookup the literal value of vcard:bday attribute. Function value is age in years based on current dateTime.
 +
 
 +
Example:
 +
* fp:age = roleAge()
  
 
=== roleAttributePattern (''role, attributePattern, valueAtt'')===
 
=== roleAttributePattern (''role, attributePattern, valueAtt'')===
Line 85: Line 100:
 
                 fp:stuffForWomen "true"^^xsd:boolean
 
                 fp:stuffForWomen "true"^^xsd:boolean
 
               ] .
 
               ] .
 
  
 
===roleDiscreteRange(''role, mappedAtt, discreteRange, valueAtt'')===
 
===roleDiscreteRange(''role, mappedAtt, discreteRange, valueAtt'')===
''rolediscreteRange'', is a subclass of p:DiscreteRange, wherein each member has been mapped (using one of several links of mapping links (e.g. sameAs)) to member(s) in a roughly equivalent subclass of p:DiscreteRange defined in the persona data model. ''mappedAtt'' is an attribute of the current person (of matching role) in the persona data model. Search all members of ''discreteRange'' for a member, M, whose mapping link points to the value of ''mappedAtt''. Return the value of the ''valueAtt'' of M.  
+
Argument ''discreteRange'' (DR1) is a subclass of p:DiscreteRange defined in an external data model. Each instance fo DR1 is mapped (using one of several links of mapping links (e.g. sameAs)) to instance(s) in another subclass of p:DiscreteRange (DR2) that is defined in the persona data model. ''mappedAtt'' is an attribute of the current person entity (of matching role) or an attribute of one of that person's sub-entities. The value of ''mappedAtt'' is an instance of DR2. Search all instances of DR1 for an instance, M, whose mapping link points to the value of ''mappedAtt''. Return the value of the ''valueAtt'' of M.  
  
 
When the function is used in reverse (i.e. to set the value of ''mappedAtt''), and when there is a one-to-many mapping link relationship between a member of DiscreteRange in the external vocabulary and N members of the corresponding DiscreteRange in the persona data model, the value pointed to the *Default mapping link (e.g. map:sameAsNDefault) should be used.
 
When the function is used in reverse (i.e. to set the value of ''mappedAtt''), and when there is a one-to-many mapping link relationship between a member of DiscreteRange in the external vocabulary and N members of the corresponding DiscreteRange in the persona data model, the value pointed to the *Default mapping link (e.g. map:sameAsNDefault) should be used.
  
 
Example:
 
Example:
* email_prefs-city_ids = roleDiscreteRange (p:Home, p:location, Groupon-City, rdfs:label)
+
* email_prefs-city_ids = roleDiscreteRange (''p:Home, p:location, Groupon-City, rdfs:label'')
  
 
===roleDiscreteRangeId (''role, mappedAtt, discreteRange'') ===
 
===roleDiscreteRangeId (''role, mappedAtt, discreteRange'') ===
Line 151: Line 165:
 
===(boolean)rolePathPathLiteral (''role, path, path2, mappedAtt'')===
 
===(boolean)rolePathPathLiteral (''role, path, path2, mappedAtt'')===
 
Start with current person. Find the the set, A, of (complex) values of its ''path'' attribute. For each member of A find the set, B, of (complex) values of its path2 attribute. Function value is literal value(s) of the ''mappedAtt'' attribute of all members of all sets B (B1, B2, ...).
 
Start with current person. Find the the set, A, of (complex) values of its ''path'' attribute. For each member of A find the set, B, of (complex) values of its path2 attribute. Function value is literal value(s) of the ''mappedAtt'' attribute of all members of all sets B (B1, B2, ...).
 
 
  
 
===roleSameAs (''role, mappedAtt'')===
 
===roleSameAs (''role, mappedAtt'')===
Line 180: Line 192:
 
* fp:placeInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, p:Place, role)
 
* fp:placeInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, p:Place, role)
 
* fp:regularInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, int:InterestTopic, role)
 
* fp:regularInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, int:InterestTopic, role)
 
=== NEW: PersonGetAttributeWhereValuesHaveAttributeOfValue (''path, valueAtt, val, [role]'')===
 
Start with current person that meets the criteria influenced by the optional ''role'' argument. Return the set of values of its entity-valued ''path'' attribute where each entity value has an attribute ''valueAtt'' whose value set includes ''val''.
 
 
Example:
 
* fp:buyer = PersonGetAttributeWhereValuesHaveAttributeOfValue (higgins:correlation, p:role, p:Buyer)
 
  
 
=== NEW: PersonGetSingleLineAddress (''[role]'')===
 
=== NEW: PersonGetSingleLineAddress (''[role]'')===

Latest revision as of 11:12, 6 June 2012

{{#eclipseproject:technology.higgins|eclipse_custom_style.css}}
Higgins logo 76Wx100H.jpg

Vocabulary for describing attribute schema mapping rules. Part of the Persona Data Model 2.0. Used by Flat Persona vocabulary and others.

Contents

Files


Person-accessor Functions (Classes)

This section lists a set of subclasses of spin:Templates. Note that these class names (unlike all others in Higgins) do not start with an initial capital letter. To learn more about the SPIN vocabulary and spin:Templates see http://spinrdf.org .

The so-called body of a spin:Template is supposed to contain an RDF representation of a set of SPARQL statements that, when interpreted, compute the value of the function (and potentially have other side effects). In the mapping vocabulary these bodies are empty since we don't presume the existence of a SPARQL interpreter. Thus implementations of these functions must be pre-compiled in some local language (Javascript, Java, etc.)


PersonGetAttributeFromList (mappedAtt, discreteRange, [role])

Start with current person that meets the criteria influenced by the optional role argument. Return the rdfs:label attribute of the entity the value of whose p:id attribute equals the stringified value of the number-valued mappedAtt attribute of the person. The entity in question is an instance of DiscreteRange subclass discreteRange. These instances of all have p:id attributes whose values are the cardinality of that entity relative to other entity instances of the class (through inference this makes them instances of ListDiscreteRange--a subclass of DiscreteRange).

Examples:

  • birthMonth = PersonAttributeFromList (fp:birthMonth, Month, null)

Where Month is a subclass of ListDiscreteRange with entity instances:

  • []
    • p:id = 1
    • rdfs:label = January
  • []
    • p:id = 2
    • rdfs:label = February
  • ...
  • []
    • p:id = 12
    • rdfs:label = December

(string) PersonGetAttributeNumberWithBounds (mappedAtt, min, max, [role])

Start with current person that meets the criteria influenced by the optional role argument. Return the string equivalent of the number-valued mappedAtt attribute of the person limiting the minimum number to min (inclusive) and the maximum value to max (inclusive).

Examples:

  • numberDaughters = PersonGetAttributeNumberWithBounds (p:numGirls, 0, 10, null)

PersonGetAttributeWhereValuesHaveAttributeOfValue (path, valueAtt, val, [role])

Start with current person that meets the criteria influenced by the optional role argument. Return the set of values of its entity-valued path attribute where each entity value has an attribute valueAtt whose value set includes val.

Example:

  • fp:buyer = PersonGetAttributeWhereValuesHaveAttributeOfValue (higgins:correlation, p:role, p:Buyer)

PersonGetAttributePDSAccountEmail (mappedAtt)

A special mapping function that returns the string email address that is the userid of their account on the PDS itself. For example, if Azigo was hosting the PDS then this might return the string "paul@azigo.com" It must be called with mappedAtt = p:pdsAccountEmail.

Example:

  • userEmail = PersonGetAttributePDSAccountEmail(p:pdsAccountEmail)

PersonGetPersonsWithAttribute (mappedAtt)

Starting with the root person in a context, return the set of all p:Person entities reachable via h:correlation links where each has the attribute mappedAtt.

Example

  • personsWithAddresses = PersonGetPersonsWithAttribute (vcard:adr)

(integer) roleAge (role)

From current person lookup the literal value of vcard:bday attribute. Function value is age in years based on current dateTime.

Example:

  • fp:age = roleAge()

roleAttributePattern (role, attributePattern, valueAtt)

Find a suitable current Person (using role if argument is provided). Search members of attributePattern for a member, M, such that (a) the current Person has all of the attributes of the map:hasAttributes object of M and (b) the values of the "map:hasAttributes" object of M (except for rdf:type and rdfs:label) are the same values as the values of the same attributes of the current Person and (c) the current Person does not have any attributes listed as the values of the hasNotAttributes attribute of M. If such an M exists, return the value of valueAtt of M.

Example:

  • my_profile-prefer_deals_for_gender = roleAttributePattern (, Groupon-PreferDealsForGender, rdfs:label)

With these three instances of Groupon-PreferDealsForGender:

 :Men-exclusively
     a       :Groupon-PreferDealsForGender ;
     rdfs:label "men"^^xsd:string ;
     map:hasAttributes
             [ a       owl:Thing ;
               fp:stuffForMen "true"^^xsd:boolean
             ] ;
     map:hasNotAttribute fp:stuffForWomen .
 :Women-exclusively
     a       :Groupon-PreferDealsForGender ;
     rdfs:label "women"^^xsd:string ;
     map:hasAttributes
             [ a       owl:Thing ;
               fp:stuffForWomen "true"^^xsd:boolean
             ] ;
     map:hasNotAttribute fp:stuffForMen .
 :Deals_for_women_and_men
     a       :Groupon-PreferDealsForGender ;
     rdfs:label "both women and men"^^xsd:string ;
     map:hasAttributes
             [ a       owl:Thing ;
               fp:stuffForMen "true"^^xsd:boolean ;
               fp:stuffForWomen "true"^^xsd:boolean
             ] .

roleDiscreteRange(role, mappedAtt, discreteRange, valueAtt)

Argument discreteRange (DR1) is a subclass of p:DiscreteRange defined in an external data model. Each instance fo DR1 is mapped (using one of several links of mapping links (e.g. sameAs)) to instance(s) in another subclass of p:DiscreteRange (DR2) that is defined in the persona data model. mappedAtt is an attribute of the current person entity (of matching role) or an attribute of one of that person's sub-entities. The value of mappedAtt is an instance of DR2. Search all instances of DR1 for an instance, M, whose mapping link points to the value of mappedAtt. Return the value of the valueAtt of M.

When the function is used in reverse (i.e. to set the value of mappedAtt), and when there is a one-to-many mapping link relationship between a member of DiscreteRange in the external vocabulary and N members of the corresponding DiscreteRange in the persona data model, the value pointed to the *Default mapping link (e.g. map:sameAsNDefault) should be used.

Example:

  • email_prefs-city_ids = roleDiscreteRange (p:Home, p:location, Groupon-City, rdfs:label)

roleDiscreteRangeId (role, mappedAtt, discreteRange)

Same as roleDiscreteRangeString() except that instead of returning the value of the rdfs:label attribute of the selected member of p:DiscreteRange it returns the value of p:id.

roleDiscreteRangeString (role, mappedAtt, discreteRange)

Equivalent to roleDiscreteRange(role, mappedAtt, discreteRange, rdfs:label)

roleEntity (role, mappedAtt)

From current person return the value(s) of its entity-valued mappedAtt attribute.

Example:

roleLiteral (role, mappedAtt)

Find best p:Person entity matching against role parameter (if any). Function value is the literal value(s) of that entity's mappedAtt attribute.

Example:

  • fp:dateOfBirth = roleLiteral (, vcard:bday)

roleLiteralStringValue (role, mappedAtt, val)

From current person return true if value literal value(s) of its mappedAtt attribute matches the value of the val parameter.

roleLiteralStringValue2 (role, mappedAtt, val)

From current person return true if value literal value(s) of its mappedAtt attribute matches the value of the val and the val2 parameters.

rolePathClass(role, path, className)

Start with current person. Function value is true if any of the values of its path attribute is the class (not an instance of) className.

rolePathClassEntity(role, path, className, mapppedAtt)

Start with current person. Find the the set, A, of (complex) values of its path attribute whose members are of class className. Function value is the set of all values of mappedAtt attribute of all members of A.

Example:

  • fp:mobilePhone = rolePathClassEntity (, vcard:tel, vcard:Cell, rdf:value)

rolePathClassLiteral(role, path, className, mapppedAtt)

Start with current person. Find the the set, A, of (complex) values of its path attribute where the values are instances of class className. Function value is literal value(s) of the mappedAtt attribute of all members of A.

Example:

  • fp:creditCardExpiration = rolePathClassLiteral (, pay:paymentMethod, pay:CreditCard, pay:ccExpiration)

rolePathEntity(role, path, mappedAtt)

Start with current person. Find the the set, A, of (complex) values of its path attribute. Function value is the set of all values of mappedAtt attribute of all members of A.

Example:

  • fp:phone = rolePathEntity (, vcard:tel, rdf:value)

rolePathLiteral (role, path, mappedAtt)

Start with current person. Find the the set, A, of (complex) values of its path attribute. Function value is literal value(s) of the mappedAtt attribute of all members of A.

Example:

  • fp:careOf = rolePathLiteral (, vcard:adr, p:careOf)

(boolean)rolePathLiteralStringValue (role, path, mappedAtt, val)

Find best p:Person entity matching against role parameter (if any). Find the the set, A, of (complex) values of the path attribute. Function value is true if any literal value(s) of the mappedAtt attribute of members of A match the value of the string val parameter.

(boolean)rolePathPathLiteral (role, path, path2, mappedAtt)

Start with current person. Find the the set, A, of (complex) values of its path attribute. For each member of A find the set, B, of (complex) values of its path2 attribute. Function value is literal value(s) of the mappedAtt attribute of all members of all sets B (B1, B2, ...).

roleSameAs (role, mappedAtt)

Indirection. The value of this function is the value of the mappedAtt in some other vocabulary.

Example:

  • avatar = roleSameAs (p:Home, fp:avatar)

roleSameAsAnd (role, mappedAtt, mappedAtt2)

Indirection. The value of this function is non-null iff the evaluation of both mappedAtt and mappedAtt2 attribute parameters (both of which are in vocabularies other than this one) are both non-null

Proposed new Person-accessor Functions (Classes)

These new functions introduce some new conventions that we should later go back and apply to all role*() functions:

  • The functions names are capitalized like regular classes
  • If it is a person-accessor then the function starts with Person
  • The optional role argument is shown as the last argument
  • The names of the functions are more descriptive of what they do
  • We can eliminate a couple duplicate functions that differ only in the strength of the typing of their arguments


NEW: PersonGetAttributeWhereValuesAreOfClass (path, className, [role])

Start with current person that meets the criteria influenced by the optional role argument. Return the set, A, of (entity) values of its path attribute whose members are of class className.

Examples:

  • fp:placeInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, p:Place, role)
  • fp:regularInterest = PersonGetAttributeWhereValuesAreOfClass(p:like, int:InterestTopic, role)

NEW: PersonGetSingleLineAddress ([role])

Start with current person that meets the criteria influenced by the optional role argument. Return the value of its v:adr attribute, an instance of vcard:Address, as transformed into to a single string.

Example:

  • fp:singleLineAddress = PersonGetSingleLineAddress ()

Proposed new non-Person-specific Functions (Classes)

ObjectGetAttributePathLiteral (path, mappedAtt)

  • TODO

RENAMED: ObjectGetAttributeSameAs (mappedAtt)

Indirection. The value of this function is the value of the mappedAtt in some other vocabulary when evaluated on the current object.

Example:

  • TODO

Mapping Attributes

The following mapping (annotation) attributes are defined:

  • sameAs - Used to link this instance or subclass of p:DiscreteRange defined in an external vocabulary with an instance or subclass of p:DiscreteRange defined in the persona data model. Functional, InverseFunctional.
  • sameAsN - Used (along with map:sameAsNDefault) to link this instance or subclass of p:DiscreteRange with N other instances or subclasses of p:DiscreteRange that are not pointed to by map:sameAs.
  • sameAsNDefault - Used (along with map:sameAsN) to link this instance or subclass of p:DiscreteRange with N other instances or subclasses of p:DiscreteRange. InverseFunctional.

Here is an example of instance-to-instance mapping using sameAs, sameAsN and sameAsNDefault:

Mapping example 2.0.100.png

Obsolete

(integer) roleDay (role, mappedAtt)

From current person return the day integer portion of the xsd:date value of its mappedAtt attribute.

Example:

  • fp:dayOfBirth = roleDay (, vcard:bday)

roleFullname (role)

Function value is string concatenation of the (string) values of the following attributes of the v:Name instance that is the value of the v:n attribute of the current person. The attributes to concatentate are: v:honorific-prefix, v:given-name, v:additional-name(s), v:family-name, v:honorific-suffix.

roleLiteralInitial (role, mappedAtt)

From current person return the upper-cased first character of the simple, literal value of its mappedAtt attribute.

roleMonth (role, mappedAtt)

From current person return the month portion of the xsd:date value of its mappedAtt attribute.

Example:

  • fp:monthOfBirth = roleMonth (, vcard:bday)


(integer) roleYear (role, mappedAtt)

Return the year integer portion of the xsd:date value of its mappedAtt attribute.

Example:

  • fp:yearOfBirth = roleYear(, vcard:bday)


Links

Back to the top