Entity
From Hypertopic
Contents |
Document Format of Entity
Entity DTD
<?xml version="1.0" encoding="UTF-8"?> <!ELEMENT entity (attribute*, resource*, topic*, relatedEntity*)> <!ELEMENT attribute EMPTY> <!ELEMENT resource EMPTY> <!ELEMENT topic (#PCDATA)> <!ELEMENT relatedEntity (#PCDATA)> <!ATTLIST attribute href CDATA #IMPLIED name CDATA #REQUIRED value CDATA #REQUIRED > <!ATTLIST resource name CDATA #REQUIRED href CDATA #REQUIRED > <!ATTLIST topic href CDATA #REQUIRED > <!ATTLIST relatedEntity relationType CDATA #IMPLIED href CDATA #REQUIRED >
Example of Entity
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE entity SYSTEM "http://tech-ada.utt.fr/validator/dtd/entity.dtd"> <entity> <attribute name="name" value="Amaya - W3C's Editor & Browser" /> <attribute name="type" value="software" /> <attribute name="license" value="W3C Software Notice and License" /> <attribute name="program language" value="C" /> <attribute name="program language" value="C++" /> <attribute name="last release" value="2006-02-10" /> <attribute name="project site" value="http://www.w3.org/Amaya/" /> <resource name="original" href="http://tech-ada.utt.fr/resource.doc" /> <resource name="HTMLVersion" href="http://tech-ada.utt.fr/resource.htm" /> <topic href="http://tech-ada.utt.fr/viewpoint/1/topic/1/">World Wide Web</topic> <relatedEntity href="http://tech-ada.utt.fr/entity/download/hypertopicprotocolstandard/" relationType="partOf"/> <relatedEntity href="http://tech-ada.utt.fr/entity/download/RESTClient/" relationType="partOf"/> </entity>
XML structure of Entity
| XPath | Cardinality | Description |
| /entity/attribute | * | Attribute values which belong to the Entity. |
| /entity/attribute/@href | Optional | Attribute value URI. |
| /entity/attribute/@name | Required | The Name of this attribute. |
| /entity/attribute/@value | Required | The value of this attribute. |
| /entity/resource | * | Resources of this entity. |
| /entity/resource/@name | Required | The name of resource. Note: The name should be unique in one entity. |
| /entity/resource/@href | Required | The location of the resource. |
| /entity/topic | * | Topics which describes the Entity. |
| /entity/topic/@href | Required | Topic URI |
| /entity/topic/@name | Optional | The name of this topic. |
| /entity/relatedEntity | * | entities which are related with this Entity. |
| /entity/relatedEntity/@href | Required | Related entity URI |
| /entity/relatedEntity/@relationType | Required | The relation type, default is "partOf". |
Create a New Entity
Add a new entity.
Arguments
entityname (Required)
- The name of entity you want to create.
Note: This method requires an HTTP PUT request.
Example Request
PUT /entity/AMAYA/
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE entity SYSTEM "http://tech-ada.utt.fr/validator/dtd/entity.dtd"> <entity> <attribute name="name" value="Amaya - W3C's Editor & Browser" /> <attribute name="type" value="software" /> <attribute name="license" value="W3C Software Notice and License" /> <attribute name="program language" value="C" /> <attribute name="program language" value="C++" /> <attribute name="last release" value="2006-02-10" /> <attribute name="project site" value="http://www.w3.org/Amaya/" /> <resource name="original" href="http://tech-ada.utt.fr/resource.doc" /> <resource name="HTMLVersion" href="http://tech-ada.utt.fr/resource.htm" /> <topic href="http://tech-ada.utt.fr/viewpoint/1/topic/1/">World Wide Web</topic> </entity>
Example Response
201 Created Location: /entity/AMAYA/
Status Codes
201: Created
- The request has been fulfilled and resulted in a new resource being created.
400: Bad Request
- The request could not be understood by the server due to malformed syntax.
500: Internal Server Error
- The server encountered an unexpected condition which prevented it from fulfilling the request.
503: Service currently unavailable
- The requested service is temporarily unavailable.
Update an Entity
set a specific entity information.
Arguments
entityname (Required)
- The name of the entity to set detail information for. You can use this method to change attributes which belongs to this entity.
Note: This method requires an HTTP PUT request.
Example Request
PUT /entity/AMAYA/
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE entity SYSTEM "http://tech-ada.utt.fr/validator/dtd/entity.dtd"> <entity> <attribute name="name" value="Amaya - W3C's Editor & Browser" /> <attribute name="type" value="software" /> <attribute name="license" value="W3C Software Notice and License" /> <attribute name="program language" value="C" /> <attribute name="program language" value="C++" /> <attribute name="last release" value="2006-02-10" /> <attribute name="project site" value="http://www.w3.org/Amaya/" /> <resource name="original" href="http://tech-ada.utt.fr/resource.doc" /> <resource name="HTMLVersion" href="http://tech-ada.utt.fr/resource.htm" /> <topic href="http://tech-ada.utt.fr/viewpoint/1/topic/1/">World Wide Web</topic> </entity>
Example Response
205 Reset Content
Status Codes
205: Reset Content
- The server has fulfilled the request and the user agent SHOULD reset the document view which caused the request to be sent.
400: Bad Request
- The request could not be understood by the server due to malformed syntax.
404: Not Found
- The server has not found anything matching the Request-URI.
500: Internal Server Error
- The server encountered an unexpected condition which prevented it from fulfilling the request.
503: Service currently unavailable
- The requested service is temporarily unavailable.
Delete an Entity
Delete a specific entity.
Arguments
entityname (Required)
- The name of the entity to be deleted.
Note: This method requires an HTTP DELETE request. Example Request
DELETE /entity/AMAYA/
Example Response
This method has no specific response - It returns an empty sucess response if it completes without error.
Status Codes
200: OK
- The request has succeeded.
404: Not Found
- The server has not found anything matching the Request-URI.
500: Internal Server Error
- The server encountered an unexpected condition which prevented it from fulfilling the request.
503: Service currently unavailable
- The requested service is temporarily unavailable.
Get an Entity
Get a specific entity information.
Arguments
entityname (Required)
- The name of the entity to fetch detail information for.
Note: This method requires an HTTP GET request.
Example Request
GET /entity/AMAYA/
Example Response
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE entity SYSTEM "http://tech-ada.utt.fr/validator/dtd/dtd/entity.dtd"> <entity> <attribute name="name" value="Amaya - W3C's Editor & Browser"/> <attribute name="type" value="software"/> <attribute name="license" value="W3C Software Notice and License"/> <attribute name="program language" value="C"/> <attribute name="program language" value="C++"/> <attribute name="last release" value="2006-02-10"/> <attribute name="project site" value="http://www.w3.org/Amaya/"/> </entity>
Status Codes
200: OK
- The request has succeeded.
404: Not Found
- The server has not found anything matching the Request-URI.
500: Internal Server Error
- The server encountered an unexpected condition which prevented it from fulfilling the request.
503: Service currently unavailable
- The requested service is temporarily unavailable.
Particular use
In documentary settings, entities MAY be document items such as sources, fragments and recursive folders. Their url structure then reflect their composition structure. The URL of a document item reflects its type :
- if it has a trailing slash, it is a folder.
- otherwise, if it uses a '+' sign (as a coordinate separator), it is a fragment and MAY have a resource named "highlight".
- otherwise, it is a source and MAY have a resource named "source".
