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 |
|---|---|
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. |
<V> Resource<V> |
getResource(V 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.
|
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<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.
|
getLabel, getRulesOfConclusion, getRulesOfHypothesis, getTypeId, isImplicitasEntity, asEntityType, asInstance, asOntologyConcept, asRelation, asRelationType, asResource, asResourceType, asRoleType, asRule, asRuleType, asType, delete, getId, isEntity, isEntityType, isInstance, isOntologyConcept, isRelation, isRelationType, isResource, isResourceType, isRoleType, isRule, isRuleType, isTypecompareToResourceType<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)
ResourceType<D> sup()
sup in interface OntologyConceptsup in interface Type@CheckReturnValue <V> Resource<V> getResource(V value)
V - The data type of the value. Supported types include: String, Long, Double, and Boolean.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 String getRegex()
null if no
regular expression is set.
By default, a ResourceType does not have a regular expression set.Copyright © 2017 Grakn Labs Ltd. All rights reserved.