[英]Updating values in ontology triples with Jena rules
I have a question. 我有个问题。 I have a Jena rule like this:
我有一条耶拿规则,例如:
[rule1:
(?if rdf:type p:InferredConfiguration)
(?if p:userName ?userEmail)
(?subProfile rdf:type u:PersonSubProfile)
(?subProfile u:hasUsername ?email)
equal(?userEmail, ?email)
(?subProfile u:hasName "")
(?subProfile u:hasLastname "")
(?subProfile u:hasPhone "")
(?subProfile u:hasEducation "Low")
->
(?subProfile u:hasPhone "00000")
print('**************** Phone defined - Rule 1 ***************')
]
The problem is that the rule above does not update the value of "hasPhone" property, but it adds one more value. 问题在于上面的规则不会更新“ hasPhone”属性的值,但是会增加一个值。 How can I update the value or remove the old one and add the new one?
如何更新值或删除旧值并添加新值?
Thank you. 谢谢。
I found solution 我找到了解决方案
[rule1:
(?if rdf:type p:InferredConfiguration)
(?if p:userName ?userEmail)
(?subProfile rdf:type u:PersonSubProfile)
(?subProfile u:hasUsername ?email)
equal(?userEmail, ?email)
(?subProfile u:hasName "")
(?subProfile u:hasLastname "")
(?subProfile u:hasPhone ?var)
equal (?var, "")
(?subProfile u:hasEducation "Low")
->
drop(7)
(?subProfile u:hasPhone "00000")
print('**************** Phone defined - Rule 1 ***************')
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.