Java Code Examples for org.openrdf.rio.RDFFormat#TRIG

The following examples show how to use org.openrdf.rio.RDFFormat#TRIG . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractInlineSELECTTestCase.java    From database with GNU General Public License v2.0 6 votes vote down vote up
/**
      * Load some RDF data.
      * 
      * @param data
      *            The in-line data to be loaded.
      * 
      * @return The #of statements parsed from the source. If there are
      *         duplicate told statements, then there may be fewer statements
      *         written onto the KB.
      * @throws UnsupportedEncodingException 
      */
     private long loadData(String data) throws UnsupportedEncodingException {
     	
     	if (data == null || data.length() == 0) {
     		return 0;
     	}
     	
     	data = ttlPrefixes() + data;

         byte utf8Data[] = data.getBytes("utf-8");
         final InputStream is = new ByteArrayInputStream(utf8Data);
         String uri = FILL_IN_URI;

         RDFFormat format = RDFFormat.TRIG;
return loadData(is, format, uri);

     }
 
Example 2
Source File: RemoteRepository.java    From database with GNU General Public License v2.0 4 votes vote down vote up
private void prepareForWire() throws Exception {
    
    if (file != null) {

        // set the data
        data = IOUtil.readBytes(file);
        
    } else if (is != null) {

        // set the data
        data = IOUtil.readBytes(is);
        
    } else if (reader != null) {

        // set the data
        data = IOUtil.readString(reader).getBytes();
        
    } else if (stmts != null) {
        
        // set the data and content type (TRIG by default)
        format = RDFFormat.TRIG;
        data = serialize(stmts, format);

    }
    
}
 
Example 3
Source File: RemoteRepository.java    From database with GNU General Public License v2.0 4 votes vote down vote up
private void prepareForWire() throws Exception {
    
    if (file != null) {

        // set the data
        data = IOUtil.readBytes(file);
        
    } else if (stmts != null) {
        
        // set the data and content type (TRIG by default)
        format = RDFFormat.TRIG;
        data = serialize(stmts, format);

    }
    
}