+struct int_list *add(l,m)
+ struct int_list *l;
+ int m;
+{
+ struct int_list *curr;
+ /* scan the list looking for m */
+ curr = l;
+ while ((curr != NULL) && (m != (curr->val)))
+ curr = curr->next;
+ if (curr == NULL)
+ /* m is not in the list */
+ {
+ curr = (struct int_list *)malloc(sizeof(struct int_list));
+ curr->val = m;
+ curr->next = l;
+ return curr;
+ }
+ else
+ return l;
+
+}
+
+print_mainhyp(about,outrel,outsort,uri,l)
+ char *about;
+ FILE *outrel,
+ *outsort;
+ char *uri;
+ struct int_list *l;
+{
+ struct int_list *curr;
+ curr = l;
+ if (!strcmp(uri,"Rel"))
+ {
+ /* scan the list */
+ while (curr != NULL)
+ {
+ fprintf(outrel,"\t<h:Object rdf:about=\"");
+ fprintf(outrel,"%s",about);
+ fprintf(outrel,"\">\n");
+ fprintf(outrel,"\t\t<h:refRel rdf:parseType=\"Resource\">");
+ fprintf(outrel,"\n\t\t\t\t<h:position rdf:resource=\"&hns;MainHypothesis\"/>");
+ fprintf(outrel,"\n\t\t\t\t<h:depth>%d</h:depth>",curr->val);
+ fprintf(outrel,"\n\t\t</h:refRel>\n");
+ fprintf(outrel,"\t</h:Object>\n");
+ curr = curr->next;
+ }
+ }
+ else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) ||
+ (!strcmp(uri,"Set")))
+ {
+ /* scan the list */
+ while (curr != NULL)
+ {
+ fprintf(outsort,"\t<h:Object rdf:about=\"");
+ fprintf(outsort,"%s",about);
+ fprintf(outsort,"\">\n");
+ fprintf(outsort,"\t\t<h:refSort rdf:parseType=\"Resource\">");
+ fprintf(outsort,"\n\t\t\t\t<h:position rdf:resource=\"&hns;MainHypothesis\"/>");
+ fprintf(outsort,"\n\t\t\t\t<h:sort rdf:resource=\"&hns;%s\"/>",uri);
+ fprintf(outsort,"\n\t\t\t\t<h:depth>%d</h:depth>",curr->val);
+ fprintf(outsort,"\n\t\t</h:refSort>\n");
+ fprintf(outsort,"\t</h:Object>\n");
+ curr = curr->next;
+ }
+ }
+ else
+ {
+ /* scan the list */
+ while (curr != NULL)
+ {
+ printf("\t\t<h:refObj rdf:parseType=\"Resource\">");
+ printf("\n\t\t\t\t<h:position rdf:resource=\"&hns;MainHypothesis\"/>");
+ printf("\n\t\t\t\t<h:depth>%d</h:depth>",curr->val);
+ printf("\n\t\t\t\t<h:occurrence><h:Object rdf:about=\"%s\"/></h:occurrence>",uri);
+ printf("\n\t\t</h:refObj>\n");
+ curr = curr->next;
+ }
+ }
+}
+
+print_mainconcl(about,outrel,outsort,uri,depth)
+ char *about;
+ FILE *outrel,
+ *outsort;
+ char *uri;
+ int depth;
+
+{
+ if (!strcmp(uri,"Rel"))
+ {
+ fprintf(outrel,"\t<h:Object rdf:about=\"");
+ fprintf(outrel,"%s",about);
+ fprintf(outrel,"\">\n");
+ fprintf(outrel,"\t\t<h:refRel rdf:parseType=\"Resource\">");
+ fprintf(outrel,"\n\t\t\t\t<h:position rdf:resource=\"&hns;MainConclusion\"/>");
+ fprintf(outrel,"\n\t\t\t\t<h:depth>%d</h:depth>",depth);
+ fprintf(outrel,"\n\t\t</h:refRel>\n");
+ fprintf(outrel,"\t</h:Object>\n");
+ }
+ else if ((!strcmp(uri,"Prop")) || (!strcmp(uri,"Type")) ||
+ (!strcmp(uri,"Set")))
+ {
+ fprintf(outsort,"\t<h:Object rdf:about=\"");
+ fprintf(outsort,"%s",about);
+ fprintf(outsort,"\">\n");
+ fprintf(outsort,"\t\t<h:refSort rdf:parseType=\"Resource\">");
+ fprintf(outsort,"\n\t\t\t\t<h:position rdf:resource=\"&hns;MainConclusion\"/>");
+ fprintf(outsort,"\n\t\t\t\t<h:sort rdf:resource=\"&hns;%s\"/>",uri);
+ fprintf(outsort,"\n\t\t\t\t<h:depth>%d</h:depth>",depth);
+ fprintf(outsort,"\n\t\t</h:refSort>\n");
+ fprintf(outsort,"\t</h:Object>\n");
+ }
+ else
+ {
+ printf("\t\t<h:refObj rdf:parseType=\"Resource\">");
+ printf("\n\t\t\t\t<h:position rdf:resource=\"&hns;MainConclusion\"/>");
+ printf("\n\t\t\t\t<h:depth>%d</h:depth>",depth);
+ printf("\n\t\t\t\t<h:occurrence><h:Object rdf:about=\"%s\"/></h:occurrence>",uri);
+ printf("\n\t\t</h:refObj>\n");
+ }
+}