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 "Org.eclipse.higgins.idasclient.cpp.core"

(New page: {{#eclipseproject:technology.higgins|eclipse_custom_style.css}} right ==Introduction== The IdAS Client C++ component provides a subset of the functional...)
 
 
(13 intermediate revisions by the same user not shown)
Line 8: Line 8:
 
* [[Org.eclipse.higgins.idas.client]]
 
* [[Org.eclipse.higgins.idas.client]]
  
In short, the IdAS Client C++ component makes it possible to resolve [[UDI]]s and and perform IdAS operations, which can be either forwarded to a remote [[Org.eclipse.higgins.idas.proxy|IdAS Proxy]] or applied to a local context file
+
In short, the IdAS Client C++ component makes it possible to resolve [[UDI]]s and to perform [[IdAS]] operations, which can be either forwarded to a remote [[Org.eclipse.higgins.idas.proxy|IdAS Proxy]] and [[Attribute Service]] or applied to a local [[Context]] file in XDI format. In both cases it relies on the [[Org.eclipse.higgins.xdi.cpp.core]] C++ component.
  
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 XML documents and Extensible Resource Identifiers (XRIs). It is being developed by the [http://www.oasis-open.org/committees/tc_home.php?wg_abbrev=xdi OASIS XDI Technical Committee].
+
The following is not currently support:
 
+
* Synchronization between a local and remote IdAS Context.
The Higgins XDI C++ component is a general-purpose implementation of some XDI concepts, e.g.:
+
* Several advanced IdAS features such as filters, models, transactions
* The basic graph model (subjects, predicates, references, literals, inner graphs)
+
* Secure storage of local Context data
* Serialization and deserialization of an XDI graph (only in the "X3 Standard" format)
+
* Multithreading
* Sending of XDI messages to XDI endpoints
+
 
+
This component is similar in its purpose as the Java [[XDI4j 1.1]] component, however it is more limited in its functionality.
+
  
 
==End-User Perspective==
 
==End-User Perspective==
  
XDI C++ is a component for use by other components and applications. It is not used by end-users directly.
+
IdAS Client C++ is a component for use by other components and applications. It is not used by end-users directly.
  
 
==Developer Perspective==
 
==Developer Perspective==
 +
 +
===API===
 +
 +
The API of this component is mostly the same as the Java [[IdAS API]], but for convenience here is a summary of the most important methods:
 +
 +
'''idasclient'''
 +
<pre>
 +
IF_ContextUdiMetadata * idasclientResolveContextMetadata(const wchar_t * contextUdi);
 +
IF_EntityUdiMetadata * idasclientResolveEntityMetadata(const wchar_t * entityUdi);
 +
IF_AttributeUdiMetadata * idasclientResolveAttributeMetadata(const wchar_t * attributeUdi);
 +
 +
IF_IdasContext * idasclientResolveContext(const wchar_t * contextUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);
 +
IF_IdasEntity * idasclientResolveEntity(const wchar_t * entityUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);
 +
IF_IdasAttribute * idasclientResolveAttribute(const wchar_t * attributeUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);
 +
</pre>
 +
 +
'''IF_IdasContext'''
 +
<pre>
 +
void open(void * authNMaterials);
 +
std::list<IF_IdasEntity *> getEntities();
 +
IF_IdasEntity * getEntity(const wchar_t * entityID);
 +
IF_IdasEntity * addEntity(const wchar_t * entityType, const wchar_t * entityID);
 +
</pre>
 +
 +
'''IF_IdasEntity'''
 +
<pre>
 +
IF_IdasContext * getContext();
 +
const wchar_t * getEntityID();
 +
const wchar_t * getEntityType();
 +
void remove();
 +
std::list<IF_IdasAttribute *> getAttributes();
 +
IF_IdasAttribute * getAttribute(const wchar_t * attributeID);
 +
IF_IdasAttribute * addAttribute(const wchar_t * attributeID);
 +
</pre>
 +
 +
'''IF_IdasAttribute'''
 +
<pre>
 +
IF_IdasEntity * getEntity();
 +
const wchar_t * getType();
 +
std::list<IF_IdasAttributeValue *> getValues();
 +
IF_IdasAttributeValue * addSimpleValue(const wchar_t * dataType, const wchar_t * data);
 +
</pre>
 +
 +
'''IF_IdasAttributeValue'''
 +
<pre>
 +
IF_IdasAttribute * getAttribute();
 +
void remove();
 +
</pre>
 +
 +
'''IF_IdasSimpleAttributeValue'''
 +
<pre>
 +
void remove();
 +
const wchar_t * getData();
 +
void setData(const wchar_t * data);
 +
</pre>
  
 
===Sample Code===
 
===Sample Code===
  
The following sample code shows how to construct and serialize a simple XDI graph using the XDI C++ component:
+
The following sample code shows how to open a local context and read a few Entities, Attributes and values:
  
 
<pre>
 
<pre>
 
int _tmain(int argc, _TCHAR* argv[]) {
 
int _tmain(int argc, _TCHAR* argv[]) {
  
// create a new graph and some sample data
+
IF_IdasAttribute * attribute;
 +
std::list<IF_IdasAttribute *> attributes;
 +
std::list<IF_IdasAttributeValue *> values;
  
IF_XdiGraph * graph = xdiNewXdiGraph();
+
// resolve a Context UDI and open the Context
graph->createSubjectPredicateReferenceStatement(L"=markus", L"+friend", L"=vitaliy");
+
graph->createSubjectPredicateLiteralStatement(L"=markus", L"+name", L"Markus Sabadello");
+
  
// find the +friend predicate and add a second reference
+
IF_IdasContext * contextAliceMeta = idasclientResolveContext(L"local:AliceMeta", NULL, NULL);
 +
 +
contextAliceMeta->open(NULL);
  
IF_XdiPredicate * predicate = graph->getSubject(L"=markus")->getPredicate(L"+friend");
+
// get Meta-Alice Entity and its h:correlations
predicate->createReference(L"=paul");
+
  
// serialize and print the graph in X3 Standard format
+
IF_IdasEntity * entityMetaAlice = contextAliceMeta->getEntity(L"Meta-Alice");
 +
wprintf(L"type of Meta-Alice in Alice's Meta context: %s\n", entityMetaAlice->getEntityType());
  
wchar_t * string;
+
attribute = entityMetaAlice->getAttribute(NAMESPACE_HIGGINS L"correlation");
xdiWriteToString(graph, & string);
+
values = attribute->getValues();
fputws(string, stdout);
+
for (std::list<IF_IdasAttributeValue *>::iterator i = values.begin(); i != values.end(); i++) {
 +
 
 +
IF_IdasSimpleAttributeValue * value = dynamic_cast<IF_IdasSimpleAttributeValue *> (* i);
 +
wprintf(L"h:correlation on Meta-Alice in Alice's Meta context: %s\n", value->getData());
 +
}
  
 
// clean up
 
// clean up
  
delete [] string;
+
values.clear();
delete graph;
+
delete attribute;
return 0;
+
 
 +
delete entityMetaAlice;
 +
 
 +
delete contextAliceMeta;
 
}
 
}
 
</pre>
 
</pre>
 +
 +
===UDIs===
 +
 +
This section describes how [[UDI]]s are handled by this component.
 +
 +
1.A. '''local://ContextID#EntityID'''
 +
--> The IdAS Client uses a local XDI file which is the same for all users. It is included with the installation and can not be modified.
 +
 +
1.B. '''local://alice@ContextID#EntityID'''
 +
--> The IdAS Client uses a local XDI file which is specific to this user ("alice"). It can be modified by the client.
 +
 +
2.A. '''sync://ContextID#EntityID'''
 +
--> The IdAS Client uses a local XDI file which is the same for all users and gets synchronized with the backend. It can only be modified by the backend.
 +
 +
2.B. '''sync://alice@ContextID#EntityID'''
 +
--> The IdAS Client uses a local XDI file which is specific to this user ("alice") and gets synchronized with the backend. It can be modified both by the client and backend.
 +
--> There can be additional, globally resolvable UDIs that point to the same Context/Entity in the backend, e.g. http://service.azigo.net/contexts/alice/ContextID#EntityID
 +
 +
3. Anything else (e.g. http URI, XRI, Gmail address, inline XRDS)
 +
--> The IdAS Client resolves and opens the Context normally via the [[Org.eclipse.higgins.idas.proxy|IdAS Proxy]].
  
 
===Building===
 
===Building===
  
The XDI C++ Higgins project is:
+
The IdAS Client C++ Higgins project is:
* app/org.eclipse.higgins.xdi.cpp.core
+
* app/org.eclipse.higgins.idasclient.cpp.core
  
 
This project can be checked out from the Eclipse repository at the following SVN URI:
 
This project can be checked out from the Eclipse repository at the following SVN URI:
Line 66: Line 147:
 
{| class="wikitable" style="text-align:left; border="1" cellpadding="5" cellspacing="0"   
 
{| class="wikitable" style="text-align:left; border="1" cellpadding="5" cellspacing="0"   
 
|-
 
|-
| https://dev.eclipse.org/svnroot/technology/org.eclipse.higgins/trunk/app/org.eclipse.higgins.xdi.cpp.core
+
| https://dev.eclipse.org/svnroot/technology/org.eclipse.higgins/trunk/app/org.eclipse.higgins.idasclient.cpp.core
 
|-
 
|-
 
|}
 
|}
  
The shared library can be built we the tools "cmake", "nmake" and MS Visual C++.
+
The shared library can be built with the tools "cmake", "nmake" and MS Visual C++.
  
 
== Links ==
 
== Links ==

Latest revision as of 19:39, 6 December 2009

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

Higgins logo 76Wx100H.jpg

Introduction

The IdAS Client C++ component provides a subset of the functionalities of the following Java components:

In short, the IdAS Client C++ component makes it possible to resolve UDIs and to perform IdAS operations, which can be either forwarded to a remote IdAS Proxy and Attribute Service or applied to a local Context file in XDI format. In both cases it relies on the Org.eclipse.higgins.xdi.cpp.core C++ component.

The following is not currently support:

  • Synchronization between a local and remote IdAS Context.
  • Several advanced IdAS features such as filters, models, transactions
  • Secure storage of local Context data
  • Multithreading

End-User Perspective

IdAS Client C++ is a component for use by other components and applications. It is not used by end-users directly.

Developer Perspective

API

The API of this component is mostly the same as the Java IdAS API, but for convenience here is a summary of the most important methods:

idasclient

 IF_ContextUdiMetadata * idasclientResolveContextMetadata(const wchar_t * contextUdi);
 IF_EntityUdiMetadata * idasclientResolveEntityMetadata(const wchar_t * entityUdi);
 IF_AttributeUdiMetadata * idasclientResolveAttributeMetadata(const wchar_t * attributeUdi);

 IF_IdasContext * idasclientResolveContext(const wchar_t * contextUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);
 IF_IdasEntity * idasclientResolveEntity(const wchar_t * entityUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);
 IF_IdasAttribute * idasclientResolveAttribute(const wchar_t * attributeUdi, const wchar_t * authNMaterialsType, const wchar_t * authNMaterials);

IF_IdasContext

void open(void * authNMaterials);
std::list<IF_IdasEntity *> getEntities();
IF_IdasEntity * getEntity(const wchar_t * entityID);
IF_IdasEntity * addEntity(const wchar_t * entityType, const wchar_t * entityID);

IF_IdasEntity

IF_IdasContext * getContext();
const wchar_t * getEntityID();
const wchar_t * getEntityType();
void remove();
std::list<IF_IdasAttribute *> getAttributes();
IF_IdasAttribute * getAttribute(const wchar_t * attributeID);
IF_IdasAttribute * addAttribute(const wchar_t * attributeID);

IF_IdasAttribute

IF_IdasEntity * getEntity();
const wchar_t * getType();
std::list<IF_IdasAttributeValue *> getValues();
IF_IdasAttributeValue * addSimpleValue(const wchar_t * dataType, const wchar_t * data);

IF_IdasAttributeValue

IF_IdasAttribute * getAttribute();
void remove();

IF_IdasSimpleAttributeValue

void remove();
const wchar_t * getData();
void setData(const wchar_t * data);

Sample Code

The following sample code shows how to open a local context and read a few Entities, Attributes and values:

int _tmain(int argc, _TCHAR* argv[]) {

	IF_IdasAttribute * attribute;
	std::list<IF_IdasAttribute *> attributes;
	std::list<IF_IdasAttributeValue *> values;

	// resolve a Context UDI and open the Context

	IF_IdasContext * contextAliceMeta = idasclientResolveContext(L"local:AliceMeta", NULL, NULL);
		
	contextAliceMeta->open(NULL);

	// get Meta-Alice Entity and its h:correlations

	IF_IdasEntity * entityMetaAlice = contextAliceMeta->getEntity(L"Meta-Alice");
	wprintf(L"type of Meta-Alice in Alice's Meta context: %s\n", entityMetaAlice->getEntityType());

	attribute = entityMetaAlice->getAttribute(NAMESPACE_HIGGINS L"correlation");
	values = attribute->getValues();
	for (std::list<IF_IdasAttributeValue *>::iterator i = values.begin(); i != values.end(); i++) {

		IF_IdasSimpleAttributeValue * value = dynamic_cast<IF_IdasSimpleAttributeValue *> (* i);
		wprintf(L"h:correlation on Meta-Alice in Alice's Meta context: %s\n", value->getData());
	}

	// clean up

	values.clear();
	delete attribute;

	delete entityMetaAlice;

	delete contextAliceMeta;
}

UDIs

This section describes how UDIs are handled by this component.

1.A. local://ContextID#EntityID --> The IdAS Client uses a local XDI file which is the same for all users. It is included with the installation and can not be modified.

1.B. local://alice@ContextID#EntityID --> The IdAS Client uses a local XDI file which is specific to this user ("alice"). It can be modified by the client.

2.A. sync://ContextID#EntityID --> The IdAS Client uses a local XDI file which is the same for all users and gets synchronized with the backend. It can only be modified by the backend.

2.B. sync://alice@ContextID#EntityID --> The IdAS Client uses a local XDI file which is specific to this user ("alice") and gets synchronized with the backend. It can be modified both by the client and backend. --> There can be additional, globally resolvable UDIs that point to the same Context/Entity in the backend, e.g. http://service.azigo.net/contexts/alice/ContextID#EntityID

3. Anything else (e.g. http URI, XRI, Gmail address, inline XRDS) --> The IdAS Client resolves and opens the Context normally via the IdAS Proxy.

Building

The IdAS Client C++ Higgins project is:

  • app/org.eclipse.higgins.idasclient.cpp.core

This project can be checked out from the Eclipse repository at the following SVN URI:

https://dev.eclipse.org/svnroot/technology/org.eclipse.higgins/trunk/app/org.eclipse.higgins.idasclient.cpp.core

The shared library can be built with the tools "cmake", "nmake" and MS Visual C++.

Links

  • 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

Copyright © Eclipse Foundation, Inc. All Rights Reserved.