Class TTLSerializer

  • All Implemented Interfaces:
    ISerializer

    public class TTLSerializer
    extends Object
    implements ISerializer
    Version:
    Jul 12, 2016
    Author:
    Axel-C. Ngonga Ngomo (ngonga@informatik.uni-leipzig.de), Mohamed Sherif (sherif@informatik.uni-leipzig.de)
    • Constructor Detail

      • TTLSerializer

        public TTLSerializer()
        Constructor
    • Method Detail

      • addStatement

        public void addStatement​(String subject,
                                 String predicate,
                                 String object,
                                 double similarity)
        Adds a statement to the list of statements to be printed
        Specified by:
        addStatement in interface ISerializer
        Parameters:
        subject - Subject of the triple
        predicate - Predicate of the triple
        object - Object of the triple
        similarity - Similarity of subject and object
      • flush

        public void flush()
      • writeToFile

        public void writeToFile​(AMapping mapping,
                                String predicate,
                                String file)
        Write the content of the mapping including the expansion of the prefixes to a file
        Specified by:
        writeToFile in interface ISerializer
        Parameters:
        mapping - Mapping to be written
        predicate - mapping predicate used to connect subjects and objects
        file - Output file
      • printPrefixes

        public void printPrefixes()
        Print prefixes
      • printStatement

        public void printStatement​(String subject,
                                   String predicate,
                                   String object,
                                   double similarity)
        Description copied from interface: ISerializer
        Prints a triple in a file. Requires the method open to have been carried out
        Specified by:
        printStatement in interface ISerializer
        Parameters:
        subject - The subject of the triple
        predicate - The predicate of the triple
        object - The object of the triple
        similarity - value
      • close

        public boolean close()
        Description copied from interface: ISerializer
        Closes the output file
        Specified by:
        close in interface ISerializer
        Returns:
        true if the file was closed successfully, else false
      • open

        public boolean open​(String file)
        Description copied from interface: ISerializer
        Opens the output file
        Specified by:
        open in interface ISerializer
        Parameters:
        file - Path to the file in which the output is to be written
        Returns:
        true if opening was carried out successfully, else false.
      • setPrefixes

        public void setPrefixes​(Map<String,​String> prefixes)
        Description copied from interface: ISerializer
        Sets the prefixes to be used in the file.
        Specified by:
        setPrefixes in interface ISerializer
        Parameters:
        prefixes - List of prefixes to use
      • getFile

        public File getFile​(String fileName)
        Description copied from interface: ISerializer
        Method to open the file with the specific name
        Specified by:
        getFile in interface ISerializer
        Parameters:
        fileName - string
        Returns:
        file instance
      • setFolderPath

        public void setFolderPath​(File f)
        Description copied from interface: ISerializer
        Method to set the folder where Serializations should be saved to.
        Specified by:
        setFolderPath in interface ISerializer
        Parameters:
        f - File which points to the folder to serialize within.