diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java
index 0e0b76d..04b106c 100644
--- a/src/main/java/widoco/CreateResources.java
+++ b/src/main/java/widoco/CreateResources.java
@@ -95,7 +95,7 @@ public static void generateDocumentation(String outFolder, Configuration c, File
if (c.isIncludeOverview()) {
overview = createOverviewSection(folderOut + File.separator + "sections", c, lode.getClassList(),
lode.getPropertyList(), lode.getDataPropList(), lode.getAnnotationPropList(),
- lode.getNamedIndividualList(), languageFile);
+ lode.getNamedIndividualList(), lode.getRuleList(), languageFile);
}
if (c.isIncludeDescription()) {
description = createDescriptionSection(folderOut + File.separator + "sections", c, languageFile);
@@ -253,7 +253,7 @@ private static String createIntroductionSection(String path, Configuration c,Pro
// the lists passed onto this method are the fixed lists
private static String createOverviewSection(String path, Configuration c, String classesList, String propList,
- String dataPropList, String annotationProps, String namedIndividuals, Properties lang) {
+ String dataPropList, String annotationProps, String namedIndividuals, String rules, Properties lang) {
String textToWrite = "";
if ((c.getOverviewPath() != null) && (!"".equals(c.getOverviewPath()))) {
textToWrite = WidocoUtils.readExternalResource(c.getOverviewPath());
@@ -279,6 +279,11 @@ private static String createOverviewSection(String path, Configuration c, String
textToWrite += ("
" + lang.getProperty(Constants.LANG_NAMED_INDIV) + "
");
textToWrite += (namedIndividuals);
}
+ if (!"".equals(rules) && rules != null ) {
+ //only eng support for now
+ textToWrite += (" Rules
");
+ textToWrite += (rules);
+ }
// add the webvowl diagram, if selected
if (c.isCreateWebVowlVisualization()) {
textToWrite += " ";
@@ -337,6 +342,10 @@ private static String createCrossReferenceSection(String path, LODEParser lodePa
if (includesNamedIndividual) {
textToWrite += lodeParser.getNamedIndividuals();
}
+ //since rules are an edge case, if they exist we add them
+ if(lodeParser.getRuleList()!=null && !lodeParser.getRuleList().isEmpty()){
+ textToWrite += lodeParser.getRules();
+ }
// Add legend (for ontology components actually used).
textToWrite += Constants.getLegend(lang, includesClass, includesProperty,
diff --git a/src/main/java/widoco/LODEParser.java b/src/main/java/widoco/LODEParser.java
index 1133aba..f27d770 100644
--- a/src/main/java/widoco/LODEParser.java
+++ b/src/main/java/widoco/LODEParser.java
@@ -63,6 +63,8 @@ public class LODEParser {
private String annotationPropList;
private String namedIndividuals;
private String namedIndividualList;
+ private String rules;
+ private String ruleList;
Configuration c;
/**
@@ -123,6 +125,14 @@ public String getNamedIndividualList() {
return namedIndividualList;
}
+ public String getRules() {
+ return rules;
+ }
+
+ public String getRuleList() {
+ return ruleList;
+ }
+
private void parse(String content, Properties langFile) {
try {
@@ -134,40 +144,54 @@ private void parse(String content, Properties langFile) {
// String cList = "", pList= "", dPList= "", c= "", p= "", dp="";
for (int i = 0; i < html.getLength(); i++) {
String attrID = html.item(i).getAttributes().item(0).getTextContent();
- if (attrID.equals("classes")) {
- classList = getTermList(html.item(i));
- classes = nodeToString(html.item(i));
- classes = classes.replace("" + langFile.getProperty(Constants.LANG_CLASSES) + "
",
- "" + langFile.getProperty(Constants.LANG_CLASSES)
- + "
");
- } else if (attrID.equals("objectproperties")) {
- propertyList = getTermList(html.item(i));
- properties = (nodeToString(html.item(i)));
- properties = properties.replace("" + langFile.getProperty(Constants.LANG_OBJ_PROP) + "
",
- "" + langFile.getProperty(Constants.LANG_OBJ_PROP)
- + "
");
- } else if (attrID.equals("dataproperties")) {
- dataPropList = (getTermList(html.item(i)));
- dataProp = (nodeToString(html.item(i)));
- dataProp = dataProp.replace("" + langFile.getProperty(Constants.LANG_DATA_PROP) + "
",
- ""
- + langFile.getProperty(Constants.LANG_DATA_PROP) + "
");
- } else if (attrID.equals("annotationproperties")) {
- annotationPropList = (getTermList(html.item(i)));
- annotationProp = (nodeToString(html.item(i)));
- annotationProp = annotationProp.replace(
- "" + langFile.getProperty(Constants.LANG_ANN_PROP) + "
",
- ""
- + langFile.getProperty(Constants.LANG_ANN_PROP) + "
");
- } else if (attrID.equals("namedindividuals")) {
- namedIndividualList = (getTermList(html.item(i)));
- namedIndividuals = (nodeToString(html.item(i)));
- namedIndividuals = namedIndividuals.replace(
- "" + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
",
- ""
- + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
");
+ switch (attrID) {
+ case "classes":
+ classList = getTermList(html.item(i));
+ classes = nodeToString(html.item(i));
+ classes = classes.replace("" + langFile.getProperty(Constants.LANG_CLASSES) + "
",
+ "" + langFile.getProperty(Constants.LANG_CLASSES)
+ + "
");
+ break;
+ case "objectproperties":
+ propertyList = getTermList(html.item(i));
+ properties = (nodeToString(html.item(i)));
+ properties = properties.replace("" + langFile.getProperty(Constants.LANG_OBJ_PROP) + "
",
+ "" + langFile.getProperty(Constants.LANG_OBJ_PROP)
+ + "
");
+ break;
+ case "dataproperties":
+ dataPropList = (getTermList(html.item(i)));
+ dataProp = (nodeToString(html.item(i)));
+ dataProp = dataProp.replace("" + langFile.getProperty(Constants.LANG_DATA_PROP) + "
",
+ ""
+ + langFile.getProperty(Constants.LANG_DATA_PROP) + "
");
+ break;
+ case "annotationproperties":
+ annotationPropList = (getTermList(html.item(i)));
+ annotationProp = (nodeToString(html.item(i)));
+ annotationProp = annotationProp.replace(
+ "" + langFile.getProperty(Constants.LANG_ANN_PROP) + "
",
+ ""
+ + langFile.getProperty(Constants.LANG_ANN_PROP) + "
");
+ break;
+ case "namedindividuals":
+ namedIndividualList = (getTermList(html.item(i)));
+ namedIndividuals = (nodeToString(html.item(i)));
+ namedIndividuals = namedIndividuals.replace(
+ "" + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
",
+ ""
+ + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
");
+ break;
+ /*missing: rules!*/
+ case "rules":
+ ruleList = (getTermList(html.item(i)));
+ rules = (nodeToString(html.item(i)));
+// rules = rules.replace(
+// "" + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
",
+// ""
+// + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "
");
+ break;
}
- /*missing: rules!*/
}
// fix ids
if (!"".equals(classList) && classList != null) {
@@ -190,14 +214,17 @@ private void parse(String content, Properties langFile) {
namedIndividualList = fixIds(namedIndividualList);
namedIndividuals = fixIds(namedIndividuals);
}
+ if (!"".equals(ruleList) && ruleList != null) {
+ ruleList = fixIds(ruleList);
+ rules = fixIds(rules);
+ //hack so "named individuals" appear as rules
+ rules = rules.replace("Named Individual ToC",
+ "Rules ToC");
+ }
logger.info("Parsing Complete!");
- } catch (ParserConfigurationException ex) {
+ } catch (ParserConfigurationException | DOMException ex) {
logger.error("Exception interpreting the resource: " + ex.getMessage());
- } catch (DOMException ex) {
- logger.error("Exception interpreting the resource: " + ex.getMessage());
- } catch (SAXException ex) {
- logger.error(MarkerFactory.getMarker("FATAL"), ex.getMessage());
- } catch (IOException ex) {
+ } catch (SAXException | IOException ex) {
logger.error(MarkerFactory.getMarker("FATAL"), ex.getMessage());
}
}
@@ -223,15 +250,8 @@ private String nodeToString(Node n) {
DOMSource source = new DOMSource(fixAnchor(n));
trans.transform(source, result);
return sw.toString();
- // String returnValue= sw.toString().replace("\n", "");
- // return(returnValue);
- } catch (IllegalArgumentException ex) {
- logger.error("Error while writing to xml " + ex.getMessage());
- // ex.printStackTrace();
- return null;
- } catch (TransformerException ex) {
+ } catch (IllegalArgumentException | TransformerException ex) {
logger.error("Error while writing to xml " + ex.getMessage());
- // ex.printStackTrace();
return null;
}
}
diff --git a/src/main/resources/lode.zip b/src/main/resources/lode.zip
index e0e4a87..9d55f37 100644
Binary files a/src/main/resources/lode.zip and b/src/main/resources/lode.zip differ
diff --git a/src/main/resources/lode/extraction.xsl b/src/main/resources/lode/extraction.xsl
index ac6817e..ed31879 100644
--- a/src/main/resources/lode/extraction.xsl
+++ b/src/main/resources/lode/extraction.xsl
@@ -38,7 +38,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
xmlns:obo="http://purl.obolibrary.org/obo/"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:sw="http://www.w3.org/2003/06/sw-vocab-status/ns#"
- xmlns:extra="https://w3id.org/extra#"
+ xmlns:widoco="https://w3id.org/widoco/vocab#"
xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.oxygenxml.com/ns/doc/xsl
http://www.oxygenxml.com/ns/doc/xsl ">
@@ -1823,7 +1823,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">
-
+
@@ -1834,7 +1834,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">