Thanks Adrian, I got the logic. I did not notice it before, thats why experience matters.
On Thu, Jul 28, 2016 at 2:05 PM, Dave Reynolds <[email protected]> wrote: > On 28/07/16 21:31, javed khan wrote: > >> Hello Dave, thanks a lot. It works. >> >> -> (?x rdf:type std:BothGradAndUnderGradCourses) >> >> Initially I thought, it will copy all the four instances of GradCourses >> and >> all the four instances of UnderGradCourses to the new class " >> std:BothGradAndUnderGradCourses" >> >> I am surprised which operator/logic actually used in the above (Then) part >> of the rule which has perform the intersection? >> > > None. There is an implicit "AND" between each term in the *if* part of the > rules. Think of the rules as being: > > (pattern1) AND (pattern2) AND ... -> (conclusion-pattern) > > So only if ?x is a GradCourse AND ?x is an UnderGradCourse do we assert > that ?x is a BothGradAndUnderGradCourse. > > Dave > > > On Thu, Jul 28, 2016 at 1:08 PM, Dave Reynolds <[email protected]> >> wrote: >> >> On 28/07/16 19:36, javed khan wrote: >>> >>> I have instances from GraduateCourses and UnderGradCourses classes: >>>> >>>> GraduateCourses UnderGradCourses >>>> >>>> Computer Vision Databases >>>> Network Security Network Security >>>> Neural Networks Assembly Language >>>> Semantic Web Semantic Web >>>> >>>> ?x rdf:type std:GradCourses ?y rdf:type >>>> std:UnderGradCourses >>>> >>>> Now ?x and ?y contains courses with "Semantic Web and Network >>>> security" >>>> common in both. >>>> >>>> Can we do some arithmetic or comparison inside Jena rules which will >>>> query/answer us the courses which are common in both? >>>> >>>> >>>> (?x rdf:type std:GradCourses) (?x rdf:type std:UnderGradCourses) >>> -> (?x rdf:type std:BothGradAndUnderGradCourses) >>> >>> or whatever you want to call the intersection class. >>> >>> This sort of intersection checking is possible in rules, in OWL or in >>> SPARQL queries. Just depends what you want to do. >>> >>> Dave >>> >>> >>> >> >
