All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.inria.corese.compiler.java.Header Maven / Gradle / Ivy

Go to download

Corese is a Semantic Web Factory (triple store and SPARQL endpoint) implementing RDF, RDFS, SPARQL 1.1 Query and Update.

The newest version!
package fr.inria.corese.compiler.java;

import java.util.Date;

/**
 *
 * @author Olivier Corby, Wimmics INRIA I3S, 2017
 *
 */
public class Header {
    static final String NL = System.getProperty("line.separator");
    
 static final String importList = 
              "import fr.inria.acacia.corese.api.IDatatype;\n"
            + "import fr.inria.acacia.corese.cg.datatype.DatatypeMap;\n"
            + "import fr.inria.corese.triple.function.extension.*;\n"  
            + "import fr.inria.corese.extension.core.Core;\n";
 
 static final String comment  = 
         "/**\n"
         + " * Code generated by LDScript Java compiler for SPARQL extension functions \n"
         + " * Compiler is run by annotation: \n"
         + " * @compile  \n"
         + " * @path     \n"
         + " * functions are called with: \n"
         + " * prefix java:  \n"
         + " * java:fun(?x) \n"
         + " *\n"
         + " * Olivier Corby - Wimmics Inria I3S - %s \n"
         + " */";
 
 

    JavaCompiler jc;
    StringBuilder sb ;
    
    Header(JavaCompiler jc){
        this.jc = jc;
        sb = new StringBuilder();
    }
    
    void process(String pack, String name) {
        sb.append("package ").append(pack).append(";");
        nl();
        nl();
        sb.append(importList);      
        nl();
        nl();
        sb.append(String.format(comment, new Date()));
        nl();
        sb.append(String.format("public class %s extends Core { ", name));
        nl();
        nl();         
    }
    
    void nl(){
        sb.append(NL);
    }
    
    StringBuilder getStringBuilder(){
        return sb;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy