Loading histream-export/src/main/java/de/sekmi/histream/export/FactClassAnnotator.java +11 −0 Original line number Diff line number Diff line Loading @@ -66,4 +66,15 @@ public class FactClassAnnotator { ((Element)fact).setAttribute("class", clazz); } } public void annotateFactSiblings(Node first){ annotateFact(first); Node next = first.getNextSibling(); while( next != null ){ if( next.getNodeType() == Node.ELEMENT_NODE && next.getLocalName().equals("fact") ){ annotateFact(next); } next = next.getNextSibling(); } } } histream-export/src/main/java/de/sekmi/histream/export/config/AbstractTable.java +13 −3 Original line number Diff line number Diff line Loading @@ -2,13 +2,23 @@ package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; @XmlTransient @XmlAccessorType(XmlAccessType.NONE) public abstract class AbstractTable { public abstract String[] getHeaders(); public abstract AbstractColumn getColumn(int index); public abstract AbstractColumn getColumnByHeader(String header); @XmlElement(name="column") Column[] columns; public String[] getHeaders(){ String[] headers = new String[columns.length]; for( int i=0; i<columns.length; i++ ){ headers[i] = columns[i].header; } return headers; } public Column getColumn(int index){ return columns[index]; } } histream-export/src/main/java/de/sekmi/histream/export/config/AbstractColumn.java→histream-export/src/main/java/de/sekmi/histream/export/config/Column.java +39 −0 Original line number Diff line number Diff line Loading @@ -3,13 +3,9 @@ package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlTransient; @XmlTransient @XmlAccessorType(XmlAccessType.NONE) @XmlSeeAlso({SequenceColumn.class, IdColumn.class}) public abstract class AbstractColumn { public class Column { /** * Column header name Loading @@ -28,25 +24,16 @@ public abstract class AbstractColumn { String na; /** * Prepare the column for the next row. This * method is called once for every row. * <p> The default implementation does nothing.</p> * XPath expression to select the column's value */ protected void prepareRow(){ @XmlAttribute(required=true) String xpath; public Column(String header, String xpath){ this.header = header; this.xpath = xpath; } /** * Initializes the column. This method will be called * only once and before any other method. */ protected void initialize(){ // constructor for JAXB protected Column(){ } /** * Get the column value for the current row. * @return String value or {@code null} for NA. */ public abstract Object getValueString(); } histream-export/src/main/java/de/sekmi/histream/export/config/Concept.java 0 → 100644 +31 −0 Original line number Diff line number Diff line package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.NONE) public class Concept { @XmlAttribute String iri; @XmlAttribute String notation; @XmlAttribute(name="wildcard-notation") String wildcardNotation; public static Concept newWildcard(String wildcardNotation){ Concept c = new Concept(); c.wildcardNotation = wildcardNotation; return c; } public static Concept newIRI(String iri){ Concept c = new Concept(); c.iri = iri; return c; } public static Concept newNotation(String notation){ Concept c = new Concept(); c.notation = notation; return c; } } histream-export/src/main/java/de/sekmi/histream/export/config/ConceptGroup.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package de.sekmi.histream.export.config; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlID; public class ConceptGroup { public ConceptGroup(String clazz){ this.clazz = clazz; this.concepts = new ArrayList<>(); } // constructor for JAXB protected ConceptGroup(){ } @XmlID @XmlAttribute(name="class") String clazz; @XmlElement(name="concept") List<Concept> concepts; } No newline at end of file Loading
histream-export/src/main/java/de/sekmi/histream/export/FactClassAnnotator.java +11 −0 Original line number Diff line number Diff line Loading @@ -66,4 +66,15 @@ public class FactClassAnnotator { ((Element)fact).setAttribute("class", clazz); } } public void annotateFactSiblings(Node first){ annotateFact(first); Node next = first.getNextSibling(); while( next != null ){ if( next.getNodeType() == Node.ELEMENT_NODE && next.getLocalName().equals("fact") ){ annotateFact(next); } next = next.getNextSibling(); } } }
histream-export/src/main/java/de/sekmi/histream/export/config/AbstractTable.java +13 −3 Original line number Diff line number Diff line Loading @@ -2,13 +2,23 @@ package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlTransient; @XmlTransient @XmlAccessorType(XmlAccessType.NONE) public abstract class AbstractTable { public abstract String[] getHeaders(); public abstract AbstractColumn getColumn(int index); public abstract AbstractColumn getColumnByHeader(String header); @XmlElement(name="column") Column[] columns; public String[] getHeaders(){ String[] headers = new String[columns.length]; for( int i=0; i<columns.length; i++ ){ headers[i] = columns[i].header; } return headers; } public Column getColumn(int index){ return columns[index]; } }
histream-export/src/main/java/de/sekmi/histream/export/config/AbstractColumn.java→histream-export/src/main/java/de/sekmi/histream/export/config/Column.java +39 −0 Original line number Diff line number Diff line Loading @@ -3,13 +3,9 @@ package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlTransient; @XmlTransient @XmlAccessorType(XmlAccessType.NONE) @XmlSeeAlso({SequenceColumn.class, IdColumn.class}) public abstract class AbstractColumn { public class Column { /** * Column header name Loading @@ -28,25 +24,16 @@ public abstract class AbstractColumn { String na; /** * Prepare the column for the next row. This * method is called once for every row. * <p> The default implementation does nothing.</p> * XPath expression to select the column's value */ protected void prepareRow(){ @XmlAttribute(required=true) String xpath; public Column(String header, String xpath){ this.header = header; this.xpath = xpath; } /** * Initializes the column. This method will be called * only once and before any other method. */ protected void initialize(){ // constructor for JAXB protected Column(){ } /** * Get the column value for the current row. * @return String value or {@code null} for NA. */ public abstract Object getValueString(); }
histream-export/src/main/java/de/sekmi/histream/export/config/Concept.java 0 → 100644 +31 −0 Original line number Diff line number Diff line package de.sekmi.histream.export.config; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; @XmlAccessorType(XmlAccessType.NONE) public class Concept { @XmlAttribute String iri; @XmlAttribute String notation; @XmlAttribute(name="wildcard-notation") String wildcardNotation; public static Concept newWildcard(String wildcardNotation){ Concept c = new Concept(); c.wildcardNotation = wildcardNotation; return c; } public static Concept newIRI(String iri){ Concept c = new Concept(); c.iri = iri; return c; } public static Concept newNotation(String notation){ Concept c = new Concept(); c.notation = notation; return c; } }
histream-export/src/main/java/de/sekmi/histream/export/config/ConceptGroup.java 0 → 100644 +24 −0 Original line number Diff line number Diff line package de.sekmi.histream.export.config; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlID; public class ConceptGroup { public ConceptGroup(String clazz){ this.clazz = clazz; this.concepts = new ArrayList<>(); } // constructor for JAXB protected ConceptGroup(){ } @XmlID @XmlAttribute(name="class") String clazz; @XmlElement(name="concept") List<Concept> concepts; } No newline at end of file