public class IlvRDFSDMModel extends IlvFilterSDMModel
Metadata consists of properties concerning the SDM model. They are used internally by SDM to add graphic properties, like x, y, layout options, and so on. Metadata is loaded and saved through XML, using RDF.
An RDF metadata item is a triple (subject, property, value) of type
(IlvMResource
, IlvMResource
, Object
). The subject and property must
be recognized as metadata (that is, isMetadata(java.lang.Object, java.lang.String)
must return
true
. The subject either belongs to the underlying model, or is
a IlvMResource
.
Namespaces: Best efforts are made to keep the namespaces inside the metadata. When a new object property is set and the prefix of the property name refers to a known namespace, the property is assumed to belong to this namespace. To simplify the processing, namespaces are assumed to be global.
Instances of this class can also be customized through metadata.
setAcceptedNamespacePrefixes(java.lang.String)
with the statement value
as argument.
setMetadataInterned(boolean)
with the statement value
converted
to Boolean as argument.
The implementation has been dramatically simplified in JViews 8.5 to improve performance. Only 'BAG' containers are supported, they contain statements only, and statements must define a non null subject.
ilog.views.sdm.metadata
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvRDFSDMModel.Subject
This subclass of
IlvMresource encapsulates an SDM model
object. |
Modifier and Type | Field and Description |
---|---|
boolean |
_cleanObjectsWhenRemoved
If
true , a call to removeObject(obj) will erase all metadata
associated with "obj" as well. |
Constructor and Description |
---|
IlvRDFSDMModel()
Empty constructor.
|
IlvRDFSDMModel(IlvSDMModel filteredModel)
Creates a new
IlvRDFSDMModel for a specified filtered model. |
Modifier and Type | Method and Description |
---|---|
void |
addNamespace(Collection ns)
Merges current namespaces with the given collection.
|
void |
clear()
This method clears current metadata and calls the
clear method of the filtered model. |
String |
getAcceptedNamespacePrefixes()
Returns the currently accepted namespace prefixes.
|
Enumeration |
getChildren(Object parent)
Returns the objects of a submodel.
|
String |
getDefaultNamespace()
Returns the current default namespace.
|
String |
getID(Object obj)
Returns the identifier of the object.
|
IlvMModel |
getMetadata()
Gets current metadata.
|
Object |
getMetadataValue(Object object,
String property)
Returns a metadata value.
|
Object |
getObject(String id)
Returns the object of the model whose identifier is
id . |
Object |
getObjectProperty(Object obj,
String property)
Returns the metadata
value if the property is metadata,
otherwise this method calls the getObjectProperty
method of the filtered model. |
String[] |
getObjectPropertyNames(Object obj)
This method calls the
getObjectPropertyNames
method of the filtered model and adds also the metadata
associated with the object. |
Enumeration |
getObjects()
Returns all the data objects added to this SDM model.
|
Object |
getParent(Object obj)
Returns the parent of an object, if that object
belongs to a submodel.
|
static IlvRDFSDMModel |
getRDFSDMModel(IlvSDMEngine engine)
Convenient function to find out the RDF model, if it exists.
|
String |
getTag(Object obj)
Returns the symbolic type (the "tag") of an object.
|
boolean |
isEditable()
Metadata is editable.
|
boolean |
isEnabled()
Returns
true if this instance is enabled. |
boolean |
isLink(Object obj)
Returns
true if the specified data object
is a link between two nodes. |
boolean |
isMetadata(Object object,
String property)
Returns whether the property is identified as metatada.
|
boolean |
isMetadataInterned()
Returns
true if metadata is interned, see setMetadataInterned(boolean) . |
void |
mergeMetadata(IlvMModel metadata)
Merges with new metadata.
|
void |
removeObject(Object object)
|
void |
setAcceptedNamespacePrefixes(String prefixes)
Sets accepted namespace prefixes.
|
void |
setDefaultNamespace(String ns)
Sets the default namespace.
|
void |
setEnabled(boolean val)
Controls whether this instance is enabled.
|
void |
setID(Object obj,
String id)
Sets the identifier of an object.
|
void |
setMetadata(IlvMModel metadata)
Sets new metadata.
|
void |
setMetadataInterned(boolean newVal)
Controls whether metadata should be in the model or not.
|
void |
setMetadataValue(Object object,
String property,
Object value)
Records a metadata.
|
void |
setObjectProperty(Object object,
String property,
Object value)
This method calls the
setObjectProperty method of
the filtered model, unless the property is identified as
metadata. |
addObject, addObjectImpl, adjustmentFinished, createLink, createNode, dataChanged, getFilteredModel, getFrom, getIDImpl, getTo, isAdjusting, linkDestinationChanged, linkSourceChanged, objectAdded, objectRemoved, propertyChanged, setAdjusting, setFilteredModel, setFrom, setIDImpl, setTo
addSDMModelListener, addSDMPropertyChangeListener, allocID, contains, fireAdjustmentFinished, fireDataChanged, fireIDChanged, fireLinkDestinationChanged, fireLinkSourceChanged, fireObjectAdded, fireObjectRemoved, firePropertyChanged, firePropertyChanged, removeSDMModelListener, removeSDMPropertyChangeListener
public boolean _cleanObjectsWhenRemoved
true
, a call to removeObject(obj)
will erase all metadata
associated with "obj" as well. The default value is false
to keep the
metadata when an object's parent changes (the object is removed and
added elsewhere in the hierarchy) or when Undo
needs to keep
removed values.public IlvRDFSDMModel()
public IlvRDFSDMModel(IlvSDMModel filteredModel)
IlvRDFSDMModel
for a specified filtered model.filteredModel
- The model that this filtering model
encapsulates.public Enumeration getObjects()
isMetadataInterned()
returns true
, the metadata subjects are
also returned.getObjects
in interface IlvSDMModel
getObjects
in class IlvFilterSDMModel
IlvSDMNode
s.public void setObjectProperty(Object object, String property, Object value)
setObjectProperty
method of
the filtered model, unless the property is identified as
metadata. In this case, setMetadataValue(java.lang.Object, java.lang.String, java.lang.Object)
is invoked.setObjectProperty
in interface IlvSDMModel
setObjectProperty
in class IlvFilterSDMModel
object
- The object whose property must be set (model object or IlvMResource
).property
- The name of the property to set.value
- The new value of the property.public Object getObjectProperty(Object obj, String property)
value
if the property is metadata,
otherwise this method calls the getObjectProperty
method of the filtered model.getObjectProperty
in interface IlvSDMModel
getObjectProperty
in class IlvFilterSDMModel
obj
- The object whose property is queried.property
- The name of the property.Object
representing the
value of the specified property, or null
if the object does not have or support the specified
property.public String[] getObjectPropertyNames(Object obj)
getObjectPropertyNames
method of the filtered model and adds also the metadata
associated with the object.getObjectPropertyNames
in interface IlvSDMModel
getObjectPropertyNames
in class IlvFilterSDMModel
obj
- The object whose property names are queried.public boolean isEditable()
setObjectProperty(java.lang.Object, java.lang.String, java.lang.Object)
will ignore the settings of regular data.isEditable
in interface IlvSDMModel
isEditable
in class IlvFilterSDMModel
public void removeObject(Object object)
removeObject
in interface IlvSDMModel
removeObject
in class IlvFilterSDMModel
object
- The object to remove.public void clear()
clear
method of the filtered model.clear
in interface IlvSDMModel
clear
in class IlvFilterSDMModel
public Enumeration getChildren(Object parent)
getChildren
in interface IlvSDMModel
getChildren
in class IlvFilterSDMModel
parent
- The parent object.null
.public Object getParent(Object obj)
null
.
getParent
in interface IlvSDMModel
getParent
in class IlvFilterSDMModel
obj
- The object whose parent is queried.null
.public boolean isLink(Object obj)
true
if the specified data object
is a link between two nodes.isLink
in interface IlvSDMModel
isLink
in class IlvFilterSDMModel
obj
- The object whose type is queried.false
.public String getID(Object obj)
getID
in interface IlvSDMModel
getID
in class IlvFilterSDMModel
obj
- The object whose identifier is requested.String
that identifies the object in a unique way.public void setID(Object obj, String id)
setID()
methods, and then changes the metadata subject
and value
if they are meant to be updated.setID
in interface IlvSDMModel
setID
in class IlvFilterSDMModel
obj
- The object whose identifier is to be changed.id
- The new identifier.public Object getObject(String id)
id
.getObject
in interface IlvSDMModel
getObject
in class IlvFilterSDMModel
id
- The identifier of the requested object.id
.public String getTag(Object obj)
getTag
in interface IlvSDMModel
getTag
in class IlvFilterSDMModel
obj
- The object whose tag is requested.String
that identifies the symbolic type of the object.public void setEnabled(boolean val)
IlvFilterSDMModel
. Other specific methods of this class work
normally, though. When enabled, the instance processes
metadata.public boolean isEnabled()
true
if this instance is enabled.true
if this instance is enabled.public void setMetadataInterned(boolean newVal)
true
, the standalone metadata, that is, metadata with subject
s
that are not in the underlying model, is returned with the
getObjects()
method. The default value is false
.public boolean isMetadataInterned()
true
if metadata is interned, see setMetadataInterned(boolean)
.public void setDefaultNamespace(String ns)
getDefaultNamespace()
public String getDefaultNamespace()
null
.public static IlvRDFSDMModel getRDFSDMModel(IlvSDMEngine engine)
engine
- The SDM engine to explore.IlvRDFSDMModel
which is in the model
pipeline of the given engine, or null
if no such instance exists.public void setAcceptedNamespacePrefixes(String prefixes)
getObjectProperty
or setObjectProperty
is accepted, it
is then intercepted by this instance, otherwise the request is
forwarded to the filtered model.prefixes
- The namespace prefixes, as a comma-separated
list. If the argument is null
, all
namespaces are accepted.public String getAcceptedNamespacePrefixes()
null
if all namespaces are accepted.public boolean isMetadata(Object object, String property)
object
is an IlvMResource
or
there is a colon ':' inside the property name. If ':' is found, then
the namespace must be in the list defined by getAcceptedNamespacePrefixes()
.object
- The object to which the property belongs.property
- The name of the property.public void setMetadataValue(Object object, String property, Object value)
object
- The object whose property must be set.property
- The name of the property to set.value
- The new value of the property. Use null
to erase the
metadata.public Object getMetadataValue(Object object, String property)
object
argument does not need
to belong to an SDM model.object
- The object whose property is searched for.property
- The name of the property.null
if no
property is found.public void setMetadata(IlvMModel metadata)
metadata
- The new metadata structure (based on RDF
statements). A
null
argument means clear the metadata.getMetadata()
public void mergeMetadata(IlvMModel metadata)
metadata
- The new metadata structure (based on RDF
statements). A null
argument means that it is ignored.setMetadata(ilog.views.sdm.metadata.IlvMModel)
public IlvMModel getMetadata()
null
.setMetadata(ilog.views.sdm.metadata.IlvMModel)
public void addNamespace(Collection ns)
ns
- A collection of {#link ilog.views.sdm.metadata.Namespace}.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.