Properties
There exists two ways of defining a property. One is to embed the property definition inside a type definition:
base <https://example.com/>;
​
type MyType {
myProperty: Type // embedded property definition.
}
This will define the https://example.com/MyType/myProperty property. Note how the base IRI changes inside the braces to match the IRI of the type. The myProperty relative IRI is resolved into https://example.com/MyType/myProperty and not https://example.com/myProperty. For this reason, one may prefer to define properties independently. This can be done using the property keyword:
base <https://example.com/>;
​
property myProperty: Type; // independent property definition.
It can then be referred to using an absolute, relative, or compact IRI:
use <https://example.com/> as ex;
​
type MyType {
<https://example.com/myProperty>,
<../myProperty>, // same as above
ex:myProperty // same as above
}
As showed in this example, when a property is defined outside the type definition, it is not required to specify its type again.
Copy link