Hi, all, I'm new to RDflib, I want to implement a feature like this:
To say, Person hasProperty Weight(kg) , Height(m), and BMI (Body Mass Index)=Weight/Height^2, so if Bob‘s Weight=70, Height=1.75, How to deduce Bob's BMI from this model?
I use the following RDF file to store the above information:
@prefix : <
http://ex.org/BMI#> .
@prefix owl: <
http://www.w3.org/2002/07/owl#> .
@prefix rdf: <
http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <
http://www.w3.org/2000/01/rdf-schema#> .
:Person rdf:type owl:Class;
:hasProperty :Height, :Weight, :BMI.
:OriginalProperty rdf:type owl:Class .
:DerivedProperty rdf:type owl:Class .
:Weight rdf:type owl:Class ;
rdfs:subClassOf :OriginalProperty .
:Height rdf:type owl:Class ;
rdfs:subClassOf :OriginalProperty .
:BMI rdf:type owl:Class ;
rdfs:subClassOf :DerivedProperty ;
:equalTo [:divide (:Weight [:power :Height])] .
:MathOperator rdf:type owl:Class .
:equalTo rdf:type owl:Class ;
rdfs:subClassOf :MathOperator .
:divide rdf:type owl:Class ;
rdfs:subClassOf :MathOperator .
:power rdf:type owl:Class ;
rdfs:subClassOf :MathOperator .
:Bob rdf:type owl:NamedIndividual , :Person ;
:hasProperty :BMIOfBob ,
:HeightOfBob ,
:WeightOfBob .
:HeightOfBob rdf:type owl:NamedIndividual , :Height ;
:hasValue 1.75 .
:WeightOfBob rdf:type owl:NamedIndividual , :Weight ;
:hasValue 70 .
:BMIOfBob rdf:type owl:NamedIndividual ,:BMI.
My idea is to read all the formulas for DerivedProperty through RDFLIB,
Bob's BMI was then calculated in python. Now my question is how do I read all the associated information of this blank node in "equalTo" by rdflib?
Or is there a better way to implement the functionality of this model with RDF?
Thank you for any help and advice.
Joylix