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 "IdAS XDI Mapping"
(→Mapping the Higgins Data Model to XDI) |
|||
Line 6: | Line 6: | ||
The [[XDI Context Provider]] implements an IdAS Context by sending XDI messages. These message can be sent either to an XDI endpoint exposed by the [[IdAS XDI Engine]] or to a native XDI endpoint. | The [[XDI Context Provider]] implements an IdAS Context by sending XDI messages. These message can be sent either to an XDI endpoint exposed by the [[IdAS XDI Engine]] or to a native XDI endpoint. | ||
− | == | + | == Concepts == |
Since the Higgins Data Model is based on RDF/OWL, and since XDI is also (conceptually) based on RDF, the basic mapping is straight-forward. However, some attention has to be paid to details. | Since the Higgins Data Model is based on RDF/OWL, and since XDI is also (conceptually) based on RDF, the basic mapping is straight-forward. However, some attention has to be paid to details. | ||
Line 36: | Line 36: | ||
* "markus@newemail.com" becomes '''$!83d3033bdaf1ad79b805cbf56df1d5c56c36d71e''' | * "markus@newemail.com" becomes '''$!83d3033bdaf1ad79b805cbf56df1d5c56c36d71e''' | ||
− | == | + | == Mappings == |
Using IdAS, a Higgins context can be opened, and operations can be performed on it. The equivalent in XDI is XDI messages (which contain XDI operations). | Using IdAS, a Higgins context can be opened, and operations can be performed on it. The equivalent in XDI is XDI messages (which contain XDI operations). | ||
Line 42: | Line 42: | ||
All XDI examples are in the X3 Simple serialization format. See [http://wiki.oasis-open.org/xdi/X3Format X3Format] for more information about X3 serialization formats. | All XDI examples are in the X3 Simple serialization format. See [http://wiki.oasis-open.org/xdi/X3Format X3Format] for more information about X3 serialization formats. | ||
− | === List all Entities in the Context === | + | === Entities === |
+ | |||
+ | ==== List all Entities in the Context ==== | ||
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 93: | Line 95: | ||
</pre> | </pre> | ||
− | === Get one Entity from the Context === | + | ==== Get one Entity from the Context ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 140: | Line 142: | ||
</pre> | </pre> | ||
− | === | + | ==== Remove an Entity from the Context ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 146: | Line 148: | ||
<pre> | <pre> | ||
IEntity entity = context.getEntity("=markus"); | IEntity entity = context.getEntity("=markus"); | ||
− | + | entity.remove(); | |
</pre> | </pre> | ||
Line 153: | Line 155: | ||
<pre> | <pre> | ||
=sender | =sender | ||
− | $ | + | $del |
/ | / | ||
=markus | =markus | ||
− | |||
</pre> | </pre> | ||
Line 162: | Line 163: | ||
<pre> | <pre> | ||
− | + | DELETE on <url>/=markus | |
</pre> | </pre> | ||
− | Reply from the XDI endpoint: | + | Reply from the XDI endpoint: (none) |
− | + | === Attributes === | |
− | = | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | === | + | ==== Get one Attribute from an Entity ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 182: | Line 176: | ||
<pre> | <pre> | ||
IEntity entity = context.getEntity("=markus"); | IEntity entity = context.getEntity("=markus"); | ||
− | entity. | + | IAttribute attribute = entity.getAttribute("http://www.example.com/name"); |
</pre> | </pre> | ||
Line 189: | Line 183: | ||
<pre> | <pre> | ||
=sender | =sender | ||
− | $ | + | $get |
/ | / | ||
=markus | =markus | ||
+ | +(http://www.example.com/name) | ||
</pre> | </pre> | ||
Line 197: | Line 192: | ||
<pre> | <pre> | ||
− | + | GET on <url>/=markus/%2B(http://www.example.com/name) | |
</pre> | </pre> | ||
− | Reply from the XDI endpoint: ( | + | Reply from the XDI endpoint: |
+ | |||
+ | <pre> | ||
+ | =markus | ||
+ | +(http://www.example.com/name) | ||
+ | / | ||
+ | $!da649486d19f8cc02350447179637cba604eff46 | ||
+ | +(http://www.example.com/name) | ||
+ | "Markus" | ||
+ | </pre> | ||
− | === Remove an Attribute from an Entity === | + | ==== Remove an Attribute from an Entity ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 230: | Line 234: | ||
Reply from the XDI endpoint: (none) | Reply from the XDI endpoint: (none) | ||
− | === Remove a Value from an Attribute === | + | === Simple Values === |
+ | |||
+ | ==== Remove a Simple Value from an Attribute ==== | ||
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 261: | Line 267: | ||
Reply from the XDI endpoint: (none) | Reply from the XDI endpoint: (none) | ||
− | === Change a Value of an Attribute === | + | ==== Change a Simple Value of an Attribute ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 295: | Line 301: | ||
Reply from the XDI endpoint: (none) | Reply from the XDI endpoint: (none) | ||
− | === Add a Value to an Attribute === | + | ==== Add a Simple Value to an Attribute ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 328: | Line 334: | ||
Reply from the XDI endpoint: (none) | Reply from the XDI endpoint: (none) | ||
− | === Get the schema of the Context === | + | === Complex Values === |
+ | |||
+ | ==== Remove a Complex Value from an Attribute ==== | ||
+ | |||
+ | [[IdAS]] calls: | ||
+ | |||
+ | <pre> | ||
+ | IEntity entity = context.getEntity("=markus"); | ||
+ | IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/friend")); | ||
+ | IAttributeValue value = attribute.getValues().next(); // value is "=sergey" | ||
+ | value.remove(); | ||
+ | </pre> | ||
+ | |||
+ | Message sent by the [[XDI Context Provider]] to <url>: | ||
+ | |||
+ | <pre> | ||
+ | =sender | ||
+ | $del | ||
+ | / | ||
+ | =markus | ||
+ | +(http://www.example.com/friend) | ||
+ | =sergey | ||
+ | </pre> | ||
+ | |||
+ | HTTP REST: | ||
+ | |||
+ | <pre> | ||
+ | DELETE on <url>/=markus/%2B(http://www.example.com/friend)/=sergey | ||
+ | </pre> | ||
+ | |||
+ | Reply from the XDI endpoint: (none) | ||
+ | |||
+ | ==== Add a Complex Value to an Attribute ==== | ||
+ | |||
+ | [[IdAS]] calls: | ||
+ | |||
+ | <pre> | ||
+ | IEntity entity = context.getEntity("=markus"); | ||
+ | IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/friend")); | ||
+ | attribute.addComplexValue(new URI("")); | ||
+ | /* ... */ | ||
+ | </pre> | ||
+ | |||
+ | Message sent by the [[XDI Context Provider]] to <url>: | ||
+ | |||
+ | <pre> | ||
+ | =sender | ||
+ | $add | ||
+ | / | ||
+ | =markus | ||
+ | +(http://www.example.com/friend) | ||
+ | =sergey | ||
+ | </pre> | ||
+ | |||
+ | HTTP REST: | ||
+ | |||
+ | <pre> | ||
+ | PUT on <url>/=markus/%2B(http://www.example.com/friend) | ||
+ | HTTP body contains "=sergey" (without the quotes) | ||
+ | </pre> | ||
+ | |||
+ | Reply from the XDI endpoint: (none) | ||
+ | |||
+ | === Miscellaneous === | ||
+ | |||
+ | ==== Get the schema of the Context ==== | ||
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 335: | Line 406: | ||
String schema = IContext.getSchema(); | String schema = IContext.getSchema(); | ||
</pre> | </pre> | ||
+ | |||
+ | Schema support in IdAS maps to XDI dictionary statements. | ||
'''TODO''' | '''TODO''' | ||
− | === Get Context Relations and Context Correlations === | + | ==== Get Context Relations and Context Correlations ==== |
[[IdAS]] calls: | [[IdAS]] calls: | ||
Line 348: | Line 421: | ||
'''TODO''' | '''TODO''' | ||
− | === Authorization === | + | ==== Authorization ==== |
Authorization support in IdAS maps to XDI link contracts. | Authorization support in IdAS maps to XDI link contracts. |
Revision as of 09:21, 9 August 2008
{{#eclipseproject:technology.higgins}} This page documents the mapping between the Higgins Data Model (which is implemented by IdAS) and XDI. XDI ("XRI Data Interchange") is a data model and protocol for sharing, linking, and synchronizing data over the Internet ("structured web") and other networks using Extensible Resource Identifiers (XRIs). It is being developed by the OASIS XDI Technical Committee.
The IdAS XDI Engine exposes an IdAS Context by receiving XDI messages.
The XDI Context Provider implements an IdAS Context by sending XDI messages. These message can be sent either to an XDI endpoint exposed by the IdAS XDI Engine or to a native XDI endpoint.
Contents
Concepts
Since the Higgins Data Model is based on RDF/OWL, and since XDI is also (conceptually) based on RDF, the basic mapping is straight-forward. However, some attention has to be paid to details.
Roughly speaking, a Higgins context can be mapped to an XDI graph using the following rules:
- An Entity maps to an XDI subject
- An Attribute maps to an XDI predicate
- Simple Values of an Attribute map to an XDI inner graph with XDI literals
- Complex Values of an Attribute map to XDI references
- A Higgins Relation maps to an XDI predicate
- A Higgins Correlation maps to the special $is XDI predicate
Hash I-Numbers
On several occasions in this mapping, it is necessary to refer to individual Simple Values of a multi-valued Attribute. Since Simple Values in Higgins IdAS do not have persistent identifiers, a mechanism called "Hash I-Number" (HIN) is used. A HIN is an i-number that is deterministically calculated from a value, therefore acting as an index of that value in the multi-valued Attribute.
This formula can be used to calculate a HIN:
HIN = '$' + '!' + hex(sha1(value))
Examples:
- "Sergey" becomes $!11cac773045ffc189fa2e3ed232843d363d019c6
- "Markus" becomes $!da649486d19f8cc02350447179637cba604eff46
- "markus.sabadello@gmail.com" becomes $!546de0b559ddcdb45983fd901f8d665ecc795e6e
- "msabadello@parityinc.net" becomes $!710e4214a22c1840fc7a829b1c3fd32375e9efca
- "markus@changedemail.com" $!6ea54708b267b24988beca6adc34c4e79ed0a0b5
- "markus@newemail.com" becomes $!83d3033bdaf1ad79b805cbf56df1d5c56c36d71e
Mappings
Using IdAS, a Higgins context can be opened, and operations can be performed on it. The equivalent in XDI is XDI messages (which contain XDI operations).
All XDI examples are in the X3 Simple serialization format. See X3Format for more information about X3 serialization formats.
Entities
List all Entities in the Context
IdAS calls:
Iterator<Entity> entities = context.getEntities(null);
Message sent by the XDI Context Provider to <url>:
=sender $get
HTTP REST:
GET on <url>
Reply from the XDI endpoint:
=markus <-- one entity in the context --> +(http://www.example.com/name) / $!da649486d19f8cc02350447179637cba604eff46 +(http://www.example.com/name) "Markus" +(http://www.example.com/location) / $!8b6cea61d247482e9e7f1e7efb1db432a69bbcb2 +(http://www.example.com/location) "Vienna" +(http://www.example.com/email) / $!546de0b559ddcdb45983fd901f8d665ecc795e6e +(http://www.example.com/email) "markus.sabadello@gmail.com" $!710e4214a22c1840fc7a829b1c3fd32375e9efca +(http://www.example.com/email) "msabadello@parityinc.net" =sergey <-- another entity in the context --> +(http://www.example.com/name) / $!11cac773045ffc189fa2e3ed232843d363d019c6 +(http://www.example.com/name) "Sergey"
Get one Entity from the Context
IdAS calls:
IEntity entity = context.getEntity("=markus");
Message sent by the XDI Context Provider to <url>:
=sender $get / =markus
HTTP REST:
GET on <url>/=markus
Reply from the XDI endpoint:
=markus +(http://www.example.com/name) / $!da649486d19f8cc02350447179637cba604eff46 +(http://www.example.com/name) "Markus" +(http://www.example.com/location) / $!8b6cea61d247482e9e7f1e7efb1db432a69bbcb2 +(http://www.example.com/location) "Vienna" +(http://www.example.com/email) / $!546de0b559ddcdb45983fd901f8d665ecc795e6e +(http://www.example.com/email) "markus.sabadello@gmail.com" $!710e4214a22c1840fc7a829b1c3fd32375e9efca +(http://www.example.com/email) "msabadello@parityinc.net"
Remove an Entity from the Context
IdAS calls:
IEntity entity = context.getEntity("=markus"); entity.remove();
Message sent by the XDI Context Provider to <url>:
=sender $del / =markus
HTTP REST:
DELETE on <url>/=markus
Reply from the XDI endpoint: (none)
Attributes
Get one Attribute from an Entity
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute("http://www.example.com/name");
Message sent by the XDI Context Provider to <url>:
=sender $get / =markus +(http://www.example.com/name)
HTTP REST:
GET on <url>/=markus/%2B(http://www.example.com/name)
Reply from the XDI endpoint:
=markus +(http://www.example.com/name) / $!da649486d19f8cc02350447179637cba604eff46 +(http://www.example.com/name) "Markus"
Remove an Attribute from an Entity
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/name")); attribute.remove();
Message sent by the XDI Context Provider to <url>:
=sender $del / =markus +(http://www.example.com/name)
HTTP REST:
DELETE on <url>/=markus/%2B(http://www.example.com/name)
Reply from the XDI endpoint: (none)
Simple Values
Remove a Simple Value from an Attribute
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/email")); IAttributeValue value = attribute.getValues().next().next(); // value is "msabadello@parityinc.net" value.remove();
Message sent by the XDI Context Provider to <url>:
=sender $del / =markus +(http://www.example.com/email) / $!710e4214a22c1840fc7a829b1c3fd32375e9efca <-- HIN of msabadello@parityinc.net -->
HTTP REST:
DELETE on <url>/=markus/%2B(http://www.example.com/email)//$!710e4214a22c1840fc7a829b1c3fd32375e9efca
Reply from the XDI endpoint: (none)
Change a Simple Value of an Attribute
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/email")); Iterator<IAttributeValue> values = (Iterator<IAttributeValue>) attribute.getValues(); IAttributeValue value = values.next(); // current value is "markus.sabadello@gmail.com" ((ITypedValue) value).setData("markus@changedemail.com");
Message sent by the XDI Context Provider to <url>:
=sender $del / =markus +(http://www.example.com/email) / $!546de0b559ddcdb45983fd901f8d665ecc795e6e <-- HIN of markus.sabadello@gmail.com --> $add / =markus +(http://www.example.com/email) / $!6ea54708b267b24988beca6adc34c4e79ed0a0b5 <-- HIN of markus@changedemail.com --> +(http://www.example.com/email) "markus@changedemail.com"
Reply from the XDI endpoint: (none)
Add a Simple Value to an Attribute
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/email")); attribute.addSimpleValue(new URI(""), "markus@newemail.com");
Message sent by the XDI Context Provider to <url>:
=sender $add / =markus +(http://www.example.com/email) / $!690e082dc615d636abdaae2b066bdbf7e2b70057 <-- HIN of markus@newemail.com --> +(http://www.example.com/email) "markus@newemail.com"
HTTP REST:
PUT on <url>/=markus/%2B(http://www.example.com/email) HTTP body contains "markus.sabadello@gmail.com" (without the quotes)
Reply from the XDI endpoint: (none)
Complex Values
Remove a Complex Value from an Attribute
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/friend")); IAttributeValue value = attribute.getValues().next(); // value is "=sergey" value.remove();
Message sent by the XDI Context Provider to <url>:
=sender $del / =markus +(http://www.example.com/friend) =sergey
HTTP REST:
DELETE on <url>/=markus/%2B(http://www.example.com/friend)/=sergey
Reply from the XDI endpoint: (none)
Add a Complex Value to an Attribute
IdAS calls:
IEntity entity = context.getEntity("=markus"); IAttribute attribute = entity.getAttribute(new URI("http://www.example.com/friend")); attribute.addComplexValue(new URI("")); /* ... */
Message sent by the XDI Context Provider to <url>:
=sender $add / =markus +(http://www.example.com/friend) =sergey
HTTP REST:
PUT on <url>/=markus/%2B(http://www.example.com/friend) HTTP body contains "=sergey" (without the quotes)
Reply from the XDI endpoint: (none)
Miscellaneous
Get the schema of the Context
IdAS calls:
String schema = IContext.getSchema();
Schema support in IdAS maps to XDI dictionary statements.
TODO
Get Context Relations and Context Correlations
IdAS calls:
IContext.getRelationships()
TODO
Authorization
Authorization support in IdAS maps to XDI link contracts.
TODO
Notifications
Notification support in IdAS maps to XDI links contracts.
TODO
Filters
Filter support in IdAS maps to XDI queries.
TODO
Links
- Higgins Home
- The XDI RDF Model is the current OASIS TC proposal for an RDF-based data model and addressing format for XDI. This document includes the proposed XDI RDF schema and a number of examples of XDI documents. (Note that it does not yet include the proposed XDI messaging format, which uses XDI documents as message envelopes for other XDI documents.)
- OASIS XDI TC Wiki
- Wikipedia page on XDI