I'm using rdflib
to store a new SIOC:Forum on a SOLID POD. https://www.w3.org/Submission/sioc-spec/#sec-modules-types states that a SIOC:Forum can have the subtype/subclass of ChatChannel. How do I model my turtle (.ttl) request to store this subclass?
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix types: <http://rdfs.org/sioc/types> .
@base <${uri}> .
:forum
a sioc:Forum ;
sioc:has_host <https://banyan.msg> ;
sioc:has_owner <${owner}> ;
rdf:type types:ChatChannel ; # <- is this correct?
sioc:has_subscriber [
a sioc:User ;
sioc:account_of <${partner}>
] .
My first guess is that you are missing the #
at the end of the types
prefix declaration. Should be @prefix types: <http://rdfs.org/sioc/types#> .
Another observation, thanks to @timbl, is that you can simplify this by just listing the multiple types on the one a
line and removing rdf
prefix and usage altogether:
a sioc:Forum, types:ChatChannel ;
#
The prefixes get swapped in directly for their corresponding prefix:
usages in the rest of the turtle document. This means your reference to types:ChatChannel
would get translated to http://rdfs.org/sioc/typesChatChannel
, which is clearly not what you want.
Do note that you may not always need the #
. It depends on the namespace. In this case you're trying to reference a particular thing embedded in a larger document, so you use the url segment to achieve that. Some namespaces, like schema.org, assign different url paths to each thing. In that case the prefix would have to end in a /
.
a
It's not at all obvious if you don't already know, but the a
keyword in turtle is an alias for the same rdf:type
predicate. See this one sentence in the w3 turtle docs. And, given that it's turtle, you can always pass a list of objects after the predicate by using a comma.