I am reading about semantic web (RDF, RDFS). In RDF, it is possible to define instances that represents individuals. For example, I can define a river called Yangtze in RDF. How can I define instances like this in RDFS? I know RDFS can help to define classes like River, Water, etc. How about defining instances that belong to that class?
-
Possible duplicate of [RDF Schema - how to create instances?](http://stackoverflow.com/questions/37311789/rdf-schema-how-to-create-instances) – unor May 23 '16 at 13:49
2 Answers
RDFS is an extension to RDF that uses RDF to define its primitives. You can define a class:
:River rdf:type rdfs:Class .
Then instances of that class are defined by the RDF statement:
:Yangtze rdf:type :River .
And you can define properties related to the class - for example an attribute (datatype property):
:name rdfs:domain :River .
:name rdfs:range xsd:string .
:Yangtze :name "Yangtze River"^^xsd:string .
..or object property (relationship):
:bordersCity rdfs:domain :River .
:bordersCity rdfs:range :City .
:City a rdfs:Class .
:Shanghai a :City .
...where a
is a shortcut for rdf:type
.

- 3,921
- 1
- 15
- 24
-
Good explanation. My confusion I guess arises from the syntax I am using. I use RDF/XML syntax, not turtle. Is it also possible in RDF/XML? – birraa May 23 '16 at 04:16
-
Turtle and RDF/XML are both text serializations of RDF, meaning an RDF tools will be able to translate these into an internally defined graph-based data structure. The primary difference is that Turtle is human-readable. RDF/XML simply isn't. Note that nether Turtle or RDF/XML are "source code" - they are text serializations. – scotthenninger May 23 '16 at 13:35
RDF and RDFS are two distinct vocabularies.
The RDF vocabulary provides you terms for defining/describing instances.
The RDFS vocabulary provides you terms for defining/describing classes.
You cannot create instances with RDFS terms. It is not designed to do that, so there is no term defined in RDFS that can create instances. To create an instance you have to use an RDF term:
rdf:type
RDF and RDFS are designed to work together. Each of them has it's own functionalities. It is true that there is a dependency between them. RDF is built using some RDFS terms, and RDFS is built using some RDF terms. See:
rdf: https://www.w3.org/1999/02/22-rdf-syntax-ns
rdfs: https://www.w3.org/2000/01/rdf-schema#
But they still remain two distinct vocabularies with two distinct functionalities.

- 1,666
- 3
- 16
- 27