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? 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 > >
