Interface Resource
- All Superinterfaces:
Element,Entity,EntityElement,ERElement,IdentifiableElement,ModelElement,Serializable
- All Known Implementing Classes:
DummyResource,ResourceImpl
@ResourceSchema(facets=,
resources=)
@TypeMetadata(name="Resource",
description="This is the base type for any Resource",
version="1.0.0")
@Change(version="1.0.0",
description="First Version")
public interface Resource
extends Entity
Represents a resource, the central entity in the facet-based model.
A resource is composed of one or more Facets, which describe its
different aspects. It can also be related to other resources. This interface
provides methods for accessing and managing these relationships. For more
details, refer to the
gCube Facet Based Resource Model Wiki.
- Author:
- Luca Frosini (ISTI - CNR)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe property name for the 'consistsOf' relations.static final StringThe property name for the 'isRelatedTo' relations.static final StringThe name of the resource type.Fields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.ERElement
CONTEXTS_PROPERTYFields inherited from interface org.gcube.informationsystem.base.reference.IdentifiableElement
ID_PROPERTY, METADATA_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY -
Method Summary
Modifier and TypeMethodDescription<C extends ConsistsOf<? extends Resource,? extends Facet>>
voidaddFacet(C relation) Adds a facet to the resource via aConsistsOfrelation.<F extends Facet>
voidaddFacet(F facet) Adds a facet to the resource.voidAdds a facet to the resource by its UUID.<I extends IsRelatedTo<? extends Resource,? extends Resource>>
voidattachResource(I relation) Attaches another resource to this one via anIsRelatedTorelation.List<ConsistsOf<? extends Resource,? extends Facet>> Returns allConsistsOfrelations for this resource, linking it to its facets.<C extends ConsistsOf<? extends Resource,? extends Facet>>
List<C>getConsistsOf(Class<C> clz) ReturnsConsistsOfrelations of a specific type.<F extends Facet,C extends ConsistsOf<? extends Resource, F>>
List<C>getConsistsOf(Class<C> clz, Class<F> target) ReturnsConsistsOfrelations of a specific type, targeting a specific facet type.Returns all facets associated with this resource.<F extends Facet,C extends ConsistsOf<? extends Resource, F>>
List<F>Returns facets of a specific type, linked by a specificConsistsOfrelation type.Returns all facets of a specific type associated with this resource.List<IsRelatedTo<? extends Resource,? extends Resource>> Returns allIsRelatedTorelations for this resource, linking it to other resources.<I extends IsRelatedTo<? extends Resource,? extends Resource>>
List<I>getIsRelatedTo(Class<I> clz) ReturnsIsRelatedTorelations of a specific type.Methods inherited from interface org.gcube.informationsystem.base.reference.Element
getTypeNameMethods inherited from interface org.gcube.informationsystem.base.reference.entities.EntityElement
getID, getMetadata, setID, setMetadataMethods inherited from interface org.gcube.informationsystem.model.reference.ERElement
getContextsMethods inherited from interface org.gcube.informationsystem.model.reference.ModelElement
getExpectedtype, getSupertypes
-
Field Details
-
NAME
The name of the resource type.- See Also:
-
CONSISTS_OF_PROPERTY
The property name for the 'consistsOf' relations.- See Also:
-
IS_RELATED_TO_PROPERTY
The property name for the 'isRelatedTo' relations.- See Also:
-
-
Method Details
-
getConsistsOf
List<ConsistsOf<? extends Resource,? extends Facet>> getConsistsOf()Returns allConsistsOfrelations for this resource, linking it to its facets.- Returns:
- A list of
ConsistsOfrelations.
-
getConsistsOf
ReturnsConsistsOfrelations of a specific type.- Type Parameters:
C- The specific type ofConsistsOfrelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
ConsistsOfrelations.
-
getConsistsOf
<F extends Facet,C extends ConsistsOf<? extends Resource, List<C> getConsistsOfF>> (Class<C> clz, Class<F> target) ReturnsConsistsOfrelations of a specific type, targeting a specific facet type.- Type Parameters:
F- The type of the target facet.C- The type of theConsistsOfrelation.- Parameters:
clz- The class of the relation type.target- The class of the target facet type.- Returns:
- A list of matching
ConsistsOfrelations.
-
getIsRelatedTo
List<IsRelatedTo<? extends Resource,? extends Resource>> getIsRelatedTo()Returns allIsRelatedTorelations for this resource, linking it to other resources.- Returns:
- A list of
IsRelatedTorelations.
-
getIsRelatedTo
<I extends IsRelatedTo<? extends Resource,? extends Resource>> List<I> getIsRelatedTo(Class<I> clz) ReturnsIsRelatedTorelations of a specific type.- Type Parameters:
I- The specific type ofIsRelatedTorelation.- Parameters:
clz- The class of the relation type.- Returns:
- A list of matching
IsRelatedTorelations.
-
getFacets
Returns all facets associated with this resource.- Returns:
- A list of all facets.
-
getFacets
Returns all facets of a specific type associated with this resource.- Type Parameters:
F- The type of the facet.- Parameters:
clz- The class of the facet type.- Returns:
- A list of matching facets.
-
getFacets
<F extends Facet,C extends ConsistsOf<? extends Resource, List<F> getFacetsF>> (Class<C> clz, Class<F> target) Returns facets of a specific type, linked by a specificConsistsOfrelation type.- Type Parameters:
F- The type of the facet.C- The type of theConsistsOfrelation.- Parameters:
clz- The class of the relation type.target- The class of the facet type.- Returns:
- A list of matching facets.
-
addFacet
Adds a facet to the resource by its UUID.- Parameters:
uuid- The UUID of the facet to add.
-
addFacet
Adds a facet to the resource.- Type Parameters:
F- The type of the facet.- Parameters:
facet- The facet instance to add.
-
addFacet
Adds a facet to the resource via aConsistsOfrelation.- Type Parameters:
C- The type of theConsistsOfrelation.- Parameters:
relation- The relation instance to add.
-
attachResource
Attaches another resource to this one via anIsRelatedTorelation.- Type Parameters:
I- The type of theIsRelatedTorelation.- Parameters:
relation- The relation instance to add.
-