Firstly, i apologise if this is off forum, but if possible, seing as i
not nearly fluent enough in sparql as of yet, I was wondering if there
was a way to optimize this query seeing as a lot of the statements are
repeated.
thanks in advance again for your continued support
John
SELECT ?partheading ?chapterheading ?Regulation ?sectionheading ?
SubRegulation ?subsectionheading ?secondsubsection
WHERE {
{ ?class rdfs:subClassOf :Part .
?part a ?class ;
:hasPartNumber ?partnumber ;
:hasHeading ?partheading
}
UNION
{ ?class1 rdfs:subClassOf :Chapter .
?chapter a ?class1 ;
:hasPartNumber ?partnumber ;
:hasChapterNumber ?chapternumber;
:hasHeading ?chapterheading .
}
UNION
{ ?class2 rdfs:subClassOf :Section .
?section a ?class2 ;
:hasPartNumber ?partnumber ;
:hasChapterNumber ?chapternumber ;
:hasSectionNumber ?sectionnumber ;
:hasHeading ?sectionheading .
OPTIONAL {?section :hasRegulationNumber ?Regulation}.
}
UNION
{ ?class3 rdfs:subClassOf :SubSection .
?subsection a ?class3 ;
:hasPartNumber ?partnumber ;
:hasChapterNumber ?chapternumber ;
:hasSectionNumber ?sectionnumber;
:hasSubSectionNumber ?subsectionnumber ;
:hasHeading ?subsectionheading ;
OPTIONAL {?subsection :hasRegulationNumber ?SubRegulation}.
}
UNION
{ ?class4 rdfs:subClassOf :SecondSubSection .
?secondsubsection a ?class4 ;
:hasPartNumber ?partnumber ;
:hasChapterNumber ?chapternumber ;
:hasSectionNumber ?sectionnumber;
:hasSubSectionNumber ?subsectionnumber ;
:hasSecondSubSectionNumber ?secondsubsectionnumber ;
OPTIONAL {?secondsubsection :hasRegulationNumber ?SubReg }.
}
UNION
{ ?class5 rdfs:subClassOf :ThirdSubSection .
?thirdsubsection a ?class5 ;
:hasPartNumber ?partnumber ;
:hasChapterNumber ?chapternumber ;
:hasSectionNumber ?sectionnumber;
:hasSubSectionNumber ?subsectionnumber ;
:hasSecondSubSectionNumber ?secondsubsectionnumber;
:hasThirdSubSectionNumber ?thirdsubsectionnumber.
}
}
ORDER by ?partnumber ?chapternumber ?sectionnumber ?subsectionnumber ?
secondsubsectionnumber
--
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en