Skip to main content

HTMLSpace Objects

HTML space implementation for XPath-based annotations. This space handles annotations on HTML content where positions are specified using XPath expressions with character offsets.

put_object_instance

Add an object instance to the HTML space. Arguments:
  • object_instance - The object instance to add to the space.
  • ranges - HtmlRange or list of HtmlRange specifying the XPath-based location(s) for the annotation.
  • on_overlap - Strategy for handling existing annotations.
    • “error” (default): Raises an error if annotation already exists.
    • “replace”: Replaces existing annotation.
  • created_at - Optional timestamp when the annotation was created.
  • created_by - Optional identifier of who created the annotation.
  • last_edited_at - Optional timestamp when the annotation was last edited.
  • last_edited_by - Optional identifier of who last edited the annotation.
  • confidence - Optional confidence score for the annotation (0.0 to 1.0).
  • manual_annotation - Optional flag indicating if this was manually annotated.
Raises:
  • LabelRowError - If annotation already exists when on_overlap=“error”.

put_classification_instance

Add a classification instance to the HTML space. Arguments:
  • classification_instance - The classification instance to add to the space.
  • on_overlap - Strategy for handling existing classifications.
    • “error” (default): Raises an error if classification of the same ontology item already exists.
    • “replace”: Overwrites existing classifications.
  • created_at - Optional timestamp when the annotation was created.
  • created_by - Optional identifier of who created the annotation.
  • last_edited_at - Optional timestamp when the annotation was last edited.
  • last_edited_by - Optional identifier of who last edited the annotation.
  • confidence - Optional confidence score for the annotation (0.0 to 1.0).
  • manual_annotation - Optional flag indicating if this was manually annotated.
Raises:
  • LabelRowError - If classification already exists when on_overlap=“error”.

remove_object_instance

Remove an object instance from the HTML space. Arguments:
  • object_hash - The hash identifier of the object instance to remove.
Returns:
  • Optional[ObjectInstance] - The removed object instance, or None if the object wasn’t found.

remove_classification_instance

Remove a classification instance from the HTML space. Arguments:
  • classification_hash - The hash identifier of the classification instance to remove.
Returns:
  • Optional[ClassificationInstance] - The removed classification instance, or None if the classification wasn’t found.