D - The data type of this resource type.
Supported Types include: String, Long, Double, and Booleanpublic interface ResourceType<D> extends Type
An ontological element which models and categorises the various Resource in the graph.
This ontological element behaves similarly to Type when defining how it relates to other
types. It has two additional functions to be aware of:
1. It has a ResourceType.DataType constraining the data types of the values it's instances may take.
2. Any of it's instances are unique to the type.
For example if you have a ResourceType modelling month throughout the year there can only be one January.
| Modifier and Type | Interface and Description |
|---|---|
static class |
ResourceType.DataType<D>
A class used to hold the supported data types of resources and any other concepts.
|
| Modifier and Type | Method and Description |
|---|---|
default ResourceType |
asResourceType()
Deprecated.
|
ResourceType<D> |
deletePlays(Role role)
Removes the Role to prevent instances of this ResourceType from playing it.
|
ResourceType<D> |
deleteScope(Thing scope)
Delete the scope specified.
|
ResourceType.DataType<D> |
getDataType()
Get the data type to which instances of the ResourceType must conform.
|
String |
getRegex()
Retrieve the regular expression to which instances of this ResourceType must conform, or
null if no
regular expression is set. |
Resource<D> |
getResource(D value)
Get the Resource with the value provided, and its type, or return NULL
|
Collection<Resource<D>> |
instances()
Returns a collection of all Resource Instances of this ResourceType.
|
default boolean |
isResourceType()
Deprecated.
|
ResourceType<D> |
key(ResourceType resourceType)
Creates a RelationType which allows this type and a resource type to be linked in a strictly one-to-one mapping.
|
ResourceType<D> |
plays(Role role)
Sets the Role which instances of this ResourceType may play.
|
Resource<D> |
putResource(D value)
Set the value for the Resource, unique to its type.
|
ResourceType<D> |
resource(ResourceType resourceType)
Creates a RelationType which allows this type and a resource type to be linked.
|
ResourceType<D> |
scope(Thing scope)
Classifies the type to a specific scope.
|
ResourceType<D> |
setAbstract(Boolean isAbstract)
Sets the ResourceType to be abstract - which prevents it from having any instances.
|
ResourceType |
setLabel(Label label)
|
ResourceType<D> |
setRegex(String regex)
Set the regular expression that instances of the ResourceType must conform to.
|
ResourceType<D> |
sub(ResourceType<D> type)
Adds another subtype to this type
|
Collection<ResourceType<D>> |
subs()
Returns a collection of subtypes of this ResourceType.
|
ResourceType<D> |
sup()
Returns the supertype of this ResourceType.
|
ResourceType<D> |
sup(ResourceType<D> type)
Sets the supertype of the ResourceType to be the ResourceType specified.
|
asType, isAbstract, isType, keys, plays, resources, scopesasOntologyConcept, getLabel, getLabelId, getRulesOfConclusion, getRulesOfHypothesis, isImplicit, isOntologyConceptasEntity, asEntityType, asRelation, asRelationType, asResource, asRole, asRule, asRuleType, asThing, delete, getId, isEntity, isEntityType, isRelation, isRelationType, isResource, isRole, isRule, isRuleType, isThingcompareToResourceType setLabel(Label label)
ResourceType<D> setAbstract(Boolean isAbstract)
setAbstract in interface TypeisAbstract - Specifies if the ResourceType is to be abstract (true) or not (false).ResourceType<D> sup(ResourceType<D> type)
type - The super type of this ResourceType.ResourceType<D> sub(ResourceType<D> type)
type - The sub type of this resource typeResourceType<D> plays(Role role)
ResourceType<D> deletePlays(Role role)
deletePlays in interface Typerole - The Role Type which the instances of this ResourceType should no longer be allowed to play.ResourceType<D> setRegex(String regex)
regex - The regular expression that instances of this ResourceType must conform to.Resource<D> putResource(D value)
value - A value for the Resource which is unique to its typeResourceType<D> scope(Thing scope)
ResourceType<D> deleteScope(Thing scope)
deleteScope in interface Typescope - The Instances that is currently scoping this Type.ResourceType<D> key(ResourceType resourceType)
ResourceType<D> resource(ResourceType resourceType)
@Nonnull ResourceType<D> sup()
sup in interface OntologyConceptsup in interface Type@CheckReturnValue @Nullable Resource<D> getResource(D value)
value - A value which a Resource in the graph may be holdingResourceCollection<ResourceType<D>> subs()
subs in interface OntologyConceptsubs in interface TypeCollection<Resource<D>> instances()
@CheckReturnValue ResourceType.DataType<D> getDataType()
@CheckReturnValue @Nullable String getRegex()
null if no
regular expression is set.
By default, a ResourceType does not have a regular expression set.@Deprecated @CheckReturnValue default ResourceType asResourceType()
ConceptasResourceType in interface ConceptRelationType if the Concept is a RelationType@Deprecated @CheckReturnValue default boolean isResourceType()
ConceptConcept is a ResourceType.isResourceType in interface ConceptConcept concept is a ResourceTypeCopyright © 2017 Grakn Labs Ltd. All rights reserved.