diff --git a/src/main/java/widoco/CreateResources.java b/src/main/java/widoco/CreateResources.java index 04b106c..590b644 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(), lode.getRuleList(), languageFile); + lode.getNamedIndividualList(), lode.getRuleList(), lode.getSwrlruleslist(),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, String rules, Properties lang) { + String dataPropList, String annotationProps, String namedIndividuals, String rules, String swrlruleslist, Properties lang) { String textToWrite = ""; if ((c.getOverviewPath() != null) && (!"".equals(c.getOverviewPath()))) { textToWrite = WidocoUtils.readExternalResource(c.getOverviewPath()); @@ -342,11 +342,15 @@ 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 + //since rules and swrl rules are an edge case, if they exist we add them if(lodeParser.getRuleList()!=null && !lodeParser.getRuleList().isEmpty()){ textToWrite += lodeParser.getRules(); } + if(lodeParser.getSwrlruleslist()!=null && !lodeParser.getSwrlruleslist().isEmpty()){ + textToWrite += lodeParser.getSwrlrules(); + } + // Add legend (for ontology components actually used). textToWrite += Constants.getLegend(lang, includesClass, includesProperty, includesDatatypeProperty, includesAnnotation, includesNamedIndividual); diff --git a/src/main/java/widoco/LODEParser.java b/src/main/java/widoco/LODEParser.java index f27d770..02c0974 100644 --- a/src/main/java/widoco/LODEParser.java +++ b/src/main/java/widoco/LODEParser.java @@ -21,6 +21,7 @@ import java.net.URLDecoder; import java.util.HashMap; import java.util.Properties; +import java.util.Objects; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -65,6 +66,8 @@ public class LODEParser { private String namedIndividualList; private String rules; private String ruleList; + private String swrlrules; + private String swrlruleslist; Configuration c; /** @@ -133,6 +136,14 @@ public String getRuleList() { return ruleList; } + public String getSwrlrules() { + return swrlrules; + } + + public String getSwrlruleslist() { + return swrlruleslist; + } + private void parse(String content, Properties langFile) { try { @@ -191,6 +202,12 @@ private void parse(String content, Properties langFile) { // "

" // + langFile.getProperty(Constants.LANG_NAMED_INDIV) + "

"); break; + case "swrlrules": + swrlruleslist = (getTermList(html.item(i))); + swrlrules = (nodeToString(html.item(i))); + swrlrules = swrlrules.replace("

SWRL rules

", + "

SWRL rules

"); + break; } } // fix ids @@ -263,6 +280,12 @@ private String nodeToString(Node n) { // (the second one) private Node fixAnchor(Node nodeToFix) { try { + String AttrID = nodeToFix.getAttributes().item(0).getTextContent(); + // Do nothing for swrl rules, they do not have + // and

+ if (Objects.equals(AttrID, "swrlrules")) { + return nodeToFix; + } NodeList outerDiv = nodeToFix.getChildNodes(); for (int i = 0; i < outerDiv.getLength(); i++) { Node currentNode = outerDiv.item(i); diff --git a/src/main/resources/lode.zip b/src/main/resources/lode.zip index 9d55f37..0d65b9d 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 ed31879..2dafcce 100644 --- a/src/main/resources/lode/extraction.xsl +++ b/src/main/resources/lode/extraction.xsl @@ -1723,7 +1723,7 @@ http://www.oxygenxml.com/ns/doc/xsl ">
  • - +
  • diff --git a/src/main/resources/lode/swrl-module.xsl b/src/main/resources/lode/swrl-module.xsl index 7079e70..78c30fa 100644 --- a/src/main/resources/lode/swrl-module.xsl +++ b/src/main/resources/lode/swrl-module.xsl @@ -28,18 +28,61 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. xmlns:f="http://www.essepuntato.it/xslt/function" xmlns:dcterms="http://purl.org/dc/terms/" xmlns="http://www.w3.org/1999/xhtml"> - + + + +
  • + + + + + + + Rule # + + + + +
  • +
    + + + + + +
    -

    Rule #

    +

    + + + + + + + + + +

    + + +

    +
    + ->

    - + @@ -140,6 +183,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

    SWRL rules

    +