public class WriteOWLHeader
extends java.lang.Object
WriteOWLHeader class processes a user-defined
header file fragment (xlmns-definitions, and prefixes
for the dc, obo, owl,
rdf, xml, xsd,
foaf, rdfs ontologies), and an OWL
base URI to generate the header section of an OWL/XML ontology.
This class is responsible for creating the initial structure of
the OWL ontology file, including essential namespace bindings,
prefix definitions, and ontology metadata. It relies on a
separate file containing preparatory annotations but contributes
significantly to the overall ontology generation process.
Key Functionalities:
Reads Pre-defined Header Data: Reads a text file containing
lines with IRI and LITERAL pairs
to create annotations.
Processes Header Annotations: Parses each line in the header
file, separating IRI and literal values.
Generates OWL Annotation Tags: Creates corresponding OWL
<Annotation> tags for each IRI-literal
pair.
Writes OWL Header: Writes the OWL header section to the output
ontology file, including namespace declarations, prefix definitions,
and the ontology IRI.
Handles I/O Operations: Manages file reading and writing operations.
Error Handling: Includes basic error handling for missing required parameters and file I/O exceptions.
Additional Notes:
The class assumes a pre-defined file format for the header data.
The base URI for the ontology is provided as an argument during object creation.
Environment:
- IDE: Eclipse IDE for Java Developers
- Version: 2021-12 (4.22.0)
- Build id: 20211202-1639
- HW Model Name: iMac, MacOS Monterey, 12.5.1
- Processor Name: Quad-Core Intel Core i5
- Processor Speed: 3.2 GHz
- Memory: 32 GB 1867 MHz DDR3
- Disk: APPLE SSD SM0256G
- Serial: DGKRC080GG7V
- Since:
- 2024/05/23
- Version:
- 1-001
- Author:
- Edit Hlaszny (https://www.hlaszny.eu/ edithlaszny@gmail.com)
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Stringcommentprivate intcountOfAnnotationsprivate OWL2_GeneratorOWL2Gprivate java.io.BufferedReaderreaderprivate java.io.BufferedWriterwriter -
Constructor Summary
Constructors Constructor Description WriteOWLHeader(java.lang.String headerDef, java.lang.String dst, java.lang.String baseURL, java.lang.String comment) -
Method Summary
Modifier and Type Method Description private voidfatalErrorMsgAndExit(java.lang.String msg)private voidwriteAnnotation(java.lang.String IRI, java.lang.String LITERAL)private voidwriteXMLhdr(java.lang.String baseURL)
-
Field Details
-
comment
private java.lang.String comment -
countOfAnnotations
private int countOfAnnotations -
OWL2G
-
reader
private java.io.BufferedReader reader -
writer
private java.io.BufferedWriter writer
-
-
Constructor Details
-
WriteOWLHeader
WriteOWLHeader(java.lang.String headerDef, java.lang.String dst, java.lang.String baseURL, java.lang.String comment)
-
-
Method Details
-
writeAnnotation
private void writeAnnotation(java.lang.String IRI, java.lang.String LITERAL) throws java.io.IOException- Throws:
java.io.IOException
-
writeXMLhdr
private void writeXMLhdr(java.lang.String baseURL) throws java.io.IOException- Throws:
java.io.IOException
-
fatalErrorMsgAndExit
private void fatalErrorMsgAndExit(java.lang.String msg)
-