Search code examples
rdfowl

Using RDF, request for suggestions on how to model one to ORed (all) members of a set and one to ANDed (all) members of a set


I am looking for a way to model using RDF a one to ORed (all) members of a set relationship as well as a one to ANDed (all) members of a set.

The task at hand how to represent (using RDF statement triples) a treatment regimen such as the one below.

Regimen "Regimen_A" consists of drug (DB14502 OR DB09449) AND DB11094

Using RDF/XML, I am now stuck at presenting the drug combination (regimen) consisting of one-of (alternative) drug from list A plus all the (non-optional) drugs from list B.

a) It is possible for a drug regimen to have zero, one or more than one alternative list as well as zero, one or more one non-optional drug list.
b) I would also like to present each drug as a resource having URIref. c) The drugs in these lists (the ORed list and the ANDed list) can be from different databases such as drugbank, ChEBI or WHOCC. For example the URIref for drugbank drug DB14502 would be "https://www.drugbank.ca/drugs/DB14502". The URI for ChEBI drug would be "http://purl.obolibrary.org/obo/CHEBI_17012" In addition to the URIref, there is a requirement to somehow explicitly provide an indication of the drug's source database.

I have been reading the RDF primer https://www.w3.org/TR/rdf-primer/ with the aim of encoding into RDF/XML the solution below as well as extend it to address the above requirements but I have not made much progress in this area.

Below is the RDF data (provided by Jeen Broekstra as an answer to my original question) I would like to transform to RDF/XML

:regimenA :consistsOf [ a :DrugAlternative; 
                        :option :DB14502;
                        :option :DB09449 ],
                      :DB11094. 

Solution

  • You can express it by introducing your own vocabulary concept for an OR.

    :regimenA :consistsOf [ a :Or; 
                            :option :DB14502;
                            :option :DB09449 ],
                          :DB11094. 
    

    For AND you don't need any special vocabulary. Perhaps better in your case, rather than a generic "logical OR", is to capture your domain semantics in the vocabulary that you introduce:

    :regimenA :consistsOf [ a :DrugAlternative; 
                            :option :DB14502;
                            :option :DB09449 ],
                          :DB11094. 
    

    You can also use standard RDF vocabulary for this kind of thing, using an rdf:Alt container. It is semantically not quite the same as a logical OR, but for most intents and purposes it comes close:

    :regimenA :consistsOf [ a rdf:Alt; 
                            rdfs:member :DB14502;
                            rdfs:member :DB09449 ],
                          :DB11094. 
    

    RDF also has standard vocabulary for expressing a list, the RDF Collection vocabulary. You could use this as follows:

    :regimenA :consistsOf (:DB14502 :DB09449), :DB11094;
    

    Potential downside here is that this way of modelling leaves the fact that the items in the list are alternatives implicit.

    Of course, if you want entailment to apply to any of this, you will have to go beyond RDF, and use either a rule language like SPIN/SHACL, or a more expressive ontology language, like OWL. However, if your goal is to have a way to express this such that you can query it later through e.g. SPARQL, then the above solutions are fine.