- From: Joy lix <joylix4112@outlook.com>
- Date: Mon, 25 Oct 2021 15:01:38 +0000
- To: "public-n3-dev@w3.org" <public-n3-dev@w3.org>
- Message-ID: <OSAPR01MB5201538837232EB30F77D652DB839@OSAPR01MB5201.jpnprd01.prod.outlook.com>
________________________________ 发件人: Joy lix 发送时间: 2021年10月25日 22:58 收件人: Jos De Roo <josderoo@gmail.com> 主题: re: Store conditional data in plain RDF Dear Jos: Thank you for your reply and help to my N3 grammar problem. As you suggested, I copied this email to the mailing list ,so that other experts can provide professional advice and help. I've been trying to store logical data containing in plain RDF, Because RDF can be read and visualized by many tools, please have a look at this example : #---------data.ttl --------- @prefix : <#> . :Person :drink :someLiquid . :someLiquid :hasRule :rule1, :rule2. :rule1 :forGender :Male ; :beverage :liquor . :rule2 :forGender :Female ; :beverage :softDrinks . :Susan a :Person ; :hasGender :Female . :John a :Person ; :hasGender :Male . #---using sparql query --------- PREFIX : <#> SELECT ?person ?gender ?beverage WHERE { :Person :drink :someLiquid . :someLiquid :hasRule ?rule . ?rule :forGender ?forGender ; :beverage ?beverage . ?person a :Person; :hasGender ?gender . FILTER ( ?gender = ?forGender ) } #---and I get results: 1 person, gender, beverage 2 :Susan, :Female, :softDrinks 3 :John, :Male, :liquor Another typical application scenario is: :Person :hasWeight :Weight; :hasHeight :Height; :hasBMI :BMI. #Body Mass Index, BMI= Weight/(Height^2) if BMI<18.5 then {:Person :bodyType :Underweight} else if BMI >=18.5 and BMI <=24.9 then {:Person :bodyType :NormalWeight} else {:Person :bodyType :OverWeight} I think the generic RDF file looks something like this: :rule1 a :rule; :if :condition1, :condition2, :condition3; :then :statement1, :statement2; :else :statement3. :condition1 a :condition; :hasSubject :condition1_Subject; :hasPredicate :condition1_Predicate; :hasObject :condition1_Object. :statement1 :hasSubject :statement1_Subject; :hasPredicate :statement1_Predicate; :hasObject :statement1_Object. I wanted to store these data in rdf turtle or in graph database, and read it with SPARQL or RDFLib when needed, then reConstruct (using python or java) a new N3 file or SHACL file to do the reasoning. I don't know if this idea of mine is feasible and easy to implement, But I do need to do this in practice to store conditional data in plain RDF. Thanks again. Best regards, Joylix
Received on Monday, 25 October 2021 15:01:54 UTC