Input Parameters

Description

The input content sent to OpenCalais is accompanied by a set of parameters (in XML format) that includes processing directives, user directives and external metadata. Please note that paramsXML must be HTTP encoded (escaped).

The input parameters for the API call are summarized here:

Parameter Section Definition Values Default
contentType Processing Directives Format of the input content (see details below) "TEXT/XML"
"TEXT/HTML"
"TEXT/HTMLRAW"
"TEXT/RAW"
(none)
outputFormat Processing Directives Format of the returned results

"XML/RDF", "Text/Simple" or "Text/Microformats" or "Application/JSON"

XML/RDF
reltagBaseURL Processing Directives Base URL to be put in rel-tag microformats <the base URL>, for example "http://myblog.com/tag" (none)
calculateRelevanceScore Processing Directives Indicates whether the extracted metadata will include relevance score for each unique entity "true" or "false" true
enableMetadataType Processing Directives Indicates whether output will include Generic Relation extractions (RDF) and/or SocialTags "GenericRelations" - to enable Generic Relations;
"SocialTags"  - to enable Social Tags (could combine comma-separated options: "GenericRelations,SocialTags"
(none)
docRDFaccessible Processing Directives Indicates whether entire XML/RDF document is saved in the Calais Linked Data repository "true" or "false" (none)
allowDistribution User Directives Indicates whether the extracted metadata can be distributed "true" or "false" false
allowSearch User Directives Indicates whether future searches can be performed on the extracted metadata "true" or "false" false
externalID User Directives User-generated ID for the submission any string (none)
submitter User Directives Identifier for the content submitter any string (none)

In addition, users can add external metadata that will be returned in the response. This can be done by embedding an RDF representation of the user's metadata in the externalMetadata node. Please be sure to embed RDF-compliant metadata (will be supported in future versions).

Check the example in the next section that shows how the parameters XML should look. Of course, you may change the parameter values and the user's external metadata as explained above.

Please note that paramsXML must start with the root element "<c:params>" ("c" can be replaced with any other prefix but the namespace must still be "http://s.opencalais.com/1/pred").

Example Parameter File

<c:params xmlns:c="http://s.opencalais.com/1/pred/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">

<c:processingDirectives c:contentType="text/txt" c:enableMetadataType="GenericRelations" c:outputFormat="xml/rdf" c:docRDFaccesible="true" >

</c:processingDirectives>

<c:userDirectives c:allowDistribution="true" c:allowSearch="true" c:externalID="17cabs901" c:submitter="ABC">

</c:userDirectives>

<c:externalMetadata>

</c:externalMetadata>

</c:params>