:: com :: sun :: star :: rdf ::

unpublished interface XDocumentMetadataAccess
Base Interfaces
XDocumentMetadataAccessXURI
┃ ┗ XResource
┃    ┗ XNodeXRepositorySupplier

XURI
(referenced interface's summary:)
represents an URI node that may occur in a RDF graph.
XRepositorySupplier
(referenced interface's summary:)
provides access to an RDF Repository.
Description
document metadata functionality related to the "manifest.rdf".

This interface contains some methods that create connections between the content and the RDF metadata of an ODF document. The main idea is to make querying and manipulating the data in the metadata manifest easier. Among other things, the metadata manifest contains a mapping between ODF elements (in the "content.xml" and "styles.xml" streams) and URIs. Such a mapping works by associating the XML ID of the ODF element with the URI by an RDF statement of the form: URI pkg:idref XmlId.

Note that this interface inherits from XResource: the UUID of the package is the string value of the RDF node. This is so that you can easily make RDF statements about the package.


Methods' Summary
getPackageUUID get the UUID for the ODF package.  
getElementByXmlId get the unique ODF element with the given XML ID.  
getElementByURI get the ODF element that corresponds to an URI.  
getURIForElement find the URI that is associated with an ODF element in the manifest.  
getOrCreateURIForElement create an URI for an ODF element.  
createMappingForElement establish mapping between an ODF Element and an URI in the manifest.  
removeMappingForElement removes mapping for an ODF element from the manifest.  
getMetadataGraphsWithType get the names of all metadata files with a given type.  
addMetadataFile add a metadata file to the manifest.  
importMetadataFile import a metadata file into the document repository, and add it to the manifest.  
removeMetadataFile remove a metadata file from the manifest and the repository.  
addContentOrStylesFile add a content or styles file to the manifest.  
removeContentOrStylesFile remove a content or styles file from the manifest.  
loadMetadataFromStorage initialize document metadata from a storage.  
storeMetadataToStorage store document metadata to a storage.  
loadMetadataFromMedium loads document metadata from a medium.  
storeMetadataToMedium stores document metadata to a medium.  
Methods' Details
getPackageUUID
string
getPackageUUID();

Description
get the UUID for the ODF package.
Returns
a universally unique ID that identifies this ODF package
getElementByXmlId
XMetadatable
getElementByXmlId( [in] string  XmlId );

Description
get the unique ODF element with the given XML ID.
Parameter XmlId
an XML ID, comprising the stream name and the "xml:id" attribute. For example: "content.xml#foo-element-1"
Returns
the ODF element with the given XML ID if it exists, else NULL
getElementByURI
XMetadatable
getElementByURI( [in] XURI  URI )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
get the ODF element that corresponds to an URI.

Convenience method that uses the mapping established in the "manifest.rdf" to locate the ODF element corresponding to an URI.

Parameter URI
an URI that may identify an ODF element
Returns
the ODF element that corresponds to the given URI, or NULL
Throws
com::sun::star::lang::IllegalArgumentException if the given URI is NULL
getURIForElement
XURI
getURIForElement( [in] XMetadatable  Element )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
find the URI that is associated with an ODF element in the manifest.
Parameter Element
the ODF element for which the URI should be returned
Returns
the URI associated with the element, or NULL
Throws
com::sun::star::lang::IllegalArgumentException if the given Element is NULL
getOrCreateURIForElement
XURI
getOrCreateURIForElement( [in] XMetadatable  Element )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
create an URI for an ODF element.

Convenience method that generates an URI for the given ODF element, and inserts a mapping between the URI and the XML ID of the ODF element into the manifest. If the element does not have a XML ID yet, a new XML ID will be generated. If an URI for the element already exists, it will be returned.

Parameter Element
the ODF element for which an URI should be created.
Returns
the URI associated with the element
Throws
com::sun::star::lang::IllegalArgumentException if the given Element is NULL
createMappingForElement
void
createMappingForElement( [in] XMetadatable  Element,
[in] XURI  URI )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException );

Description
establish mapping between an ODF Element and an URI in the manifest.

This method Convenience method that generates an URI for the given ODF element, and inserts a mapping between the URI and the XML ID of the ODF element into the manifest. If the element does not have a XML ID yet, a new XML ID will be generated. If there already exists an URI for the element, the mapping will not be changed, and an ::com::sun::star::container::ElementExistException will be thrown.

Note that the mapping maintained by this method is a one-to-one mapping, even though the specification technically permits mapping an XML ID to multiple URIs.

Parameter Element
the ODF element with which an URI should be associated
Parameter URI
the URI which should be associated with the Element
Throws
com::sun::star::lang::IllegalArgumentException if any argument is NULL
Throws
com::sun::star::container::ElementExistException if either the URI or the XML ID of the Element is already mapped
removeMappingForElement
void
removeMappingForElement( [in] XMetadatable  Element )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
removes mapping for an ODF element from the manifest.
Parameter Element
the ODF element for which the mapping should be removed
Throws
com::sun::star::lang::IllegalArgumentException if the given Element is NULL
getMetadataGraphsWithType
sequence< XURI >
getMetadataGraphsWithType( [in] XURI  Type )
raises( ::com::sun::star::lang::IllegalArgumentException );

Description
get the names of all metadata files with a given type.
Parameter Type
the rdf:type property of the requested named graphs
Returns
the names of all metadata graphs that have a rdf:type property with the given Type as object
Throws
com::sun::star::lang::IllegalArgumentException if the given Type is NULL
addMetadataFile
void
addMetadataFile( [in] string  FileName,
[in] XURI  GraphName,
[in] sequence< XURI >  Types )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::ElementExistException );

Description
add a metadata file to the manifest.

This convenience method does the following:

  • create a new graph with the given GraphName in the repository
  • insert the required statements declaring the new graph to be a metadata file into the manifest graph
  • insert statements declaring rdf:type properties for the new graph into the manifest graph

Parameter FileName
the name of the stream in the ODF package where the graph will be stored
Parameter GraphName
the name of the graph that is to be created
Parameter Types
a list of types that will be inserted as rdf:type properties for the graph
Throws
com::sun::star::lang::IllegalArgumentException if the given GraphName is NULL, or the FileName is invalid
Throws
com::sun::star::container::ElementExistException if a graph with the given GraphName, or a stream with the given FileName, already exists
importMetadataFile
void
importMetadataFile( [in] short  Format,
[in] ::com::sun::star::io::XInputStream  InStream,
[in] string  FileName,
[in] XURI  GraphName,
[in] XURI  BaseURI,
[in] sequence< XURI >  Types )
raises( ::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::datatransfer::UnsupportedFlavorException,
::com::sun::star::container::ElementExistException,
ParseException,
::com::sun::star::io::IOException );

Description
import a metadata file into the document repository, and add it to the manifest.

This convenience method does the following:

  • import the given file into a graph with the given GraphName in the repository
  • insert the required statements declaring the new graph to be a metadata file into the manifest graph
  • Parameter FileName
    the name of the stream in the ODF package where the graph will be stored
    Parameter GraphName
    the name of the graph that is to be created
    Parameter BaseURI
    a base URI to resolve relative URI references
    Parameter Types
    a list of types that will be inserted as rdf:type properties for the graph
    Throws
    com::sun::star::lang::IllegalArgumentException if the given stream or the GraphName is NULL, or BaseURI is NULL and the format requires use of a base URI, or the FileName is invalid
    Throws
    com::sun::star::datatransfer::UnsupportedFlavorException if the format requested is unknown or not supported
    Throws
    com::sun::star::container::ElementExistException if a graph with the given GraphName, or a stream with the given FileName, already exists
    Throws
    ParseException if the input does not conform to the specified file format.
    Throws
    com::sun::star::io::IOException if an I/O error occurs.
    removeMetadataFile
    void
    removeMetadataFile( [in] XURI  GraphName )
    raises( ::com::sun::star::lang::IllegalArgumentException,
    ::com::sun::star::container::NoSuchElementException );

    Description
    remove a metadata file from the manifest and the repository.

    This convenience method does the following:

  • delete the graph with the given GraphName in the repository
  • remove the statements declaring the graph to be a metadata file from the manifest graph
  • Parameter GraphName
    the name of the graph that is to be removed
    Throws
    com::sun::star::lang::IllegalArgumentException if the given GraphName is NULL
    Throws
    com::sun::star::container::NoSuchElementException if a graph with the given GraphName does not exist
    addContentOrStylesFile
    void
    addContentOrStylesFile( [in] string  FileName )
    raises( ::com::sun::star::lang::IllegalArgumentException,
    ::com::sun::star::container::ElementExistException );

    Description
    add a content or styles file to the manifest.

    This convenience method adds the required statements declaring a content or styles file to the manifest graph.

    • If the FileName ends in "content.xml", an odf:ContentFile is added.
    • If the FileName ends in "styles.xml" , an odf:StylesFile is added.
    • Other FileNames are invalid.

    Parameter FileName
    the name of the stream in the ODF package
    Throws
    com::sun::star::lang::IllegalArgumentException if the FileName is invalid
    Throws
    com::sun::star::container::ElementExistException if a stream with the given FileName already exists
    removeContentOrStylesFile
    void
    removeContentOrStylesFile( [in] string  FileName )
    raises( ::com::sun::star::lang::IllegalArgumentException,
    ::com::sun::star::container::NoSuchElementException );

    Description
    remove a content or styles file from the manifest.

    This convenience method removes the statements declaring a content or styles file from the manifest graph, as well as all mappings that refer to the file.

    Parameter FileName
    the name of the stream in the ODF package
    Throws
    com::sun::star::lang::IllegalArgumentException if the FileName is invalid
    Throws
    com::sun::star::container::NoSuchElementException if a graph with the given GraphName does not exist
    loadMetadataFromStorage
    void
    loadMetadataFromStorage( [in] ::com::sun::star::embed::XStorage  Storage,
    [in] XURI  BaseURI )
    raises( ::com::sun::star::lang::IllegalArgumentException );

    Description
    initialize document metadata from a storage.

    This method re-initializes the document metadata, loads the stream named "manifest.rdf" from the storage, and then loads all metadata streams mentioned in the manifest.

    Note that it is not an error if the storage does not contain a manifest. In this case, the document metadata will be default initialized.

    Parameter Storage
    a storage, representing e.g. an ODF package file
    Parameter BaseURI
    a base URI to resolve relative URI references
    Throws
    com::sun::star::lang::IllegalArgumentException if any argument is NULL
    storeMetadataToStorage
    void
    storeMetadataToStorage( [in] ::com::sun::star::embed::XStorage  Storage )
    raises( ::com::sun::star::lang::IllegalArgumentException );

    Description
    store document metadata to a storage.

    This method stores all the graphs in the document metadata repository to the given storage.

    Note that to be stored correctly, a named graph must have a complete entry in the manifest graph, with a pkg:path property that denotes a legal stream name.

    Parameter Storage
    a storage, representing e.g. an ODF package file
    Throws
    com::sun::star::lang::IllegalArgumentException if any argument is NULL
    loadMetadataFromMedium
    void
    loadMetadataFromMedium( [in] sequence< ::com::sun::star::beans::PropertyValue >  Medium )
    raises( ::com::sun::star::lang::IllegalArgumentException,
    ::com::sun::star::lang::WrappedTargetException,
    ::com::sun::star::io::IOException );

    Description
    loads document metadata from a medium.
    Parameter Medium
    the com::sun::star::document::MediaDescriptor representing the source
    Throws
    com::sun::star::lang::IllegalArgumentException if the argument does not contain a URL or Stream property
    Throws
    com::sun::star::lang::WrappedTargetException if thrown when trying to access the medium
    Throws
    com::sun::star::io::IOException if thrown when trying to access the medium
    storeMetadataToMedium
    void
    storeMetadataToMedium( [in] sequence< ::com::sun::star::beans::PropertyValue >  Medium )
    raises( ::com::sun::star::lang::IllegalArgumentException,
    ::com::sun::star::lang::WrappedTargetException,
    ::com::sun::star::io::IOException );

    Description
    stores document metadata to a medium.
    Parameter Medium
    the com::sun::star::document::MediaDescriptor representing the target
    Throws
    com::sun::star::lang::IllegalArgumentException if the argument does not contain a URL or Stream property
    Throws
    com::sun::star::lang::WrappedTargetException if thrown when trying to access the medium
    Throws
    com::sun::star::io::IOException if thrown when trying to access the medium
    Top of Page