Use of specifying rdfs:range Constraint in RDF Schema ?

Events happening in the community are now at Drupal community events on www.drupal.org.
mayankkandpal's picture

I am Mayank, Final year undergraduate student at DA-IICT, India. Since I am relatively new to Drupal-7 RDF, I would really appreciate if you could help me out here.

I have created a custom content type for my project purpose. The RDF Schema for the vocacbulary seems to have registered properly with Drupal and in the Database Tables. However, the issue that I am facing is that the value constraints that I have set within the Schema are not having any effect on the RDF that is generated.

For example, for a particular property 'difficulty', I have set the range as a particular class 'difficultytypes' defined by me and then I have made a few instances(high, low, medium) of that class. I understand that this should constrain the accepted set of values for that property.

Education

However, contrary to this, when I set the predicate of a field as :difficulty, and give the input other than those in the rdfs:range set(i.e. other than high, medium and low), even then the value shows in the generated RDF.

I understand that the RDF module is not a system lying on top of Drupal that alters the way Drupal works. It simply exposes the internal structure of our Drupal site in RDF.

However, I fail to understand the purpose of specifying rdfs:range for the rdf:Property if it accepts and displays any given values in the RDF. I thought that the values would be shown in the generated RDF only if they are instances of the class which is specified as the range of the Property.

Please help me out.

Thanks.

Comments

Example of the schema:

mayankkandpal's picture

Sorry, this didnt show up properly on the above post :

{rdf:Property rdf:ID="difficulty"}
{rdfs:label>Education</rdfs:label}
{rdfs:domain rdf:resource="#learningobject"/}
{rdfs:range rdf:resource="#difficultytypes" /}
{/rdf:Property}

{rdfs:Class rdf:ID="difficultytypes" /}
{difficultytypes rdf:ID="high" /}
{difficultytypes rdf:ID="medium" /}
{difficultytypes rdf:ID="low" /}

As you can see, the range for difficulty is set to the instances of the class difficultytypes, which are high, medium and low.

No constraint checking

scor's picture

Drupal does not do any constraint checking from the RDF schema you specify, Drupal just blindly output the data and mark it up with the RDF mappings you have provided.

However, I fail to understand the purpose of specifying rdfs:range for the rdf:Property if it accepts and displays any given values in the RDF. I thought that the values would be shown in the generated RDF only if they are instances of the class which is specified as the range of the Property.

What modules are you using and where did you specify any rdfs:range? in any case, if you were to specify any range/domain, it would not be used by Drupal out of the box. it could be used by some consumer applications, though you would have to ensure the data Drupal outputs is in line with these RDFS constraints.

jbusse's picture

Hi,
this is a common error in understanding RDFS:
c.f. http://www.w3.org/TR/rdf-schema/#ch_domain
domain and range information is used to derive the type of subject and predicate. in RDFS there is nothing similar to a database integrity constraint.
Johannes

Got it !

mayankkandpal's picture

Thanks a lot scor and jbusse.
Really appreciate the quick and accurate response :)

Mayank

Semantic Web

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: