hylar/server/controller.js
function(req, res, next) {
        var initialTime = req.query.time,
            receivedReqTime = new Date().getTime(),
            filename = req.params.filename,
            absolutePathToFile = ontoDir + '/' + filename,
            extension = path.extname(absolutePathToFile),
            contentType = mime.contentType(extension);

        if(contentType) {
            req.mimeType = contentType.replace(/;.*/g, '');
        } else {
            req.mimeType = contentType;
        }

        req.requestDelay =  receivedReqTime - initialTime;

        fs.readFile(absolutePathToFile, function(err, data) {
            if(err) {
                res.status(500).send(err.toString());
            } else {
                req.rawOntology = data.toString().replace(/(&)([a-z0-9]+)(;)/gi, '$2:');
                next();
            };
        });
    }
function(req, res, next) {
        var initialTime = req.query.time,
            receivedReqTime = new Date().getTime(),
            filename = req.params.filename,
            absolutePathToFile = ontoDir + '/' + filename,
            extension = path.extname(absolutePathToFile),
            contentType = mime.contentType(extension);

        if(contentType) {
            req.mimeType = contentType.replace(/;.*/g, '');
        } else {
            req.mimeType = contentType;
        }

        req.requestDelay =  receivedReqTime - initialTime;

        fs.readFile(absolutePathToFile, function(err, data) {
            if(err) {
                res.status(500).send(err.toString());
            } else {
                req.rawOntology = data.toString().replace(/(&)([a-z0-9]+)(;)/gi, '$2:');
                next();
            };
        });
    }
function ( req , res , next ) { var initialTime = req . query . time , receivedReqTime = new Date ( ) . getTime ( ) , filename = req . params . filename , absolutePathToFile = ontoDir + '/' + filename , extension = path . extname ( absolutePathToFile ) , contentType = mime . contentType ( extension ) ; if ( contentType ) { req . mimeType = contentType . replace ( / ;.* / g , '' ) ; } else { req . mimeType = contentType ; } req . requestDelay = receivedReqTime - initialTime ; fs . readFile ( absolutePathToFile , function ( err , data ) { if ( err ) { res . status ( 500 ) . send ( err . toString ( ) ) ; } else { req . rawOntology = data . toString ( ) . replace ( / (&)([a-z0-9]+)(;) / gi , '$2:' ) ; next ( ) ; } ; } ) ; }
OWL File content to text
@param req
@param res
@param next
OWL File content to text