当前位置: 首页>>代码示例>>Java>>正文


Java StrUtils.strjoin方法代码示例

本文整理汇总了Java中org.apache.jena.atlas.lib.StrUtils.strjoin方法的典型用法代码示例。如果您正苦于以下问题:Java StrUtils.strjoin方法的具体用法?Java StrUtils.strjoin怎么用?Java StrUtils.strjoin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.atlas.lib.StrUtils的用法示例。


在下文中一共展示了StrUtils.strjoin方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: browseSemanticWeb

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * Downloads a file making its best:
 * - following redirects
 * - implementing the best content negotiation
 * curl -I -L -H "Accept: application/rdf+xml" http://datos.bne.es/resource/XX947766
 */
public static String browseSemanticWeb(String url) {
    String document = "";
    String acceptHeaderValue = StrUtils.strjoin(",", "application/rdf+xml", "application/turtle;q=0.9", "application/x-turtle;q=0.9", "text/n3;q=0.8", "text/turtle;q=0.8", "text/rdf+n3;q=0.7", "application/xml;q=0.5", "text/xml;q=0.5", "text/plain;q=0.4", "*/*;q=0.2");
    boolean redirect = false;
    try {
        URL obj = new URL(url);
        HttpURLConnection conn = (HttpURLConnection) obj.openConnection();
        conn.setRequestProperty("Accept", acceptHeaderValue);
        conn.setReadTimeout(5000);
        int status = conn.getResponseCode();
        if (status != HttpURLConnection.HTTP_OK) {
            if (status == HttpURLConnection.HTTP_MOVED_TEMP
                    || status == HttpURLConnection.HTTP_MOVED_PERM
                    || status == HttpURLConnection.HTTP_SEE_OTHER) {
                redirect = true;
            }
        }
        if (redirect) {
            String newUrl = conn.getHeaderField("Location");
            String cookies = conn.getHeaderField("Set-Cookie");
            conn = (HttpURLConnection) new URL(newUrl).openConnection();
            conn.setRequestProperty("Cookie", cookies);
        }
        BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String inputLine;
        StringBuffer html = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
            html.append(inputLine);
        }
        in.close();
        document = html.toString();
    } catch (Exception e) {
        System.err.println(e.getMessage());
    }
    return document;
}
 
开发者ID:oeg-upm,项目名称:odrlapi,代码行数:43,代码来源:RDFUtils.java

示例2: load3

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * 複数回ロードする。
 */
public static void load3() {
    System.out.println("##### load3 #####");
    GraphStore graphStore = createGraphStore();
    printDebug(graphStore, "before");
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph>",
            "LOAD <file:/data/rdf/update-data2.ttl> INTO GRAPH <http://sparqlbook.jp/graph>");
    UpdateAction.parseExecute(cmd, graphStore);
    printDebug(graphStore, "after");
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:14,代码来源:LoadExamples.java

示例3: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * MOVEの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data2.ttl> INTO GRAPH <http://sparqlbook.jp/graph2>",
            "LOAD <file:/data/rdf/update-data3.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:15,代码来源:MoveExamples.java

示例4: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * ADDの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data2.ttl> INTO GRAPH <http://sparqlbook.jp/graph2>",
            "LOAD <file:/data/rdf/update-data3.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:15,代码来源:AddExamples.java

示例5: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * DROPの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    // load
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph2>",
            "LOAD <file:/data/rdf/update-data1.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:16,代码来源:DropExamples.java

示例6: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * INSERT DATAの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data4.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data4.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:14,代码来源:DeleteDataExamples.java

示例7: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * INSERTの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data5.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>");
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:13,代码来源:InsertDeleteExamples.java

示例8: loadData2

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * DELETE/INSERTの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData2() {
    GraphStore graphStore = createGraphStore();
    // load
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data6.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data6.ttl> INTO GRAPH <http://sparqlbook.jp/graph2>");
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:15,代码来源:InsertDeleteExamples.java

示例9: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * CLEARの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    // load
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph2>",
            "LOAD <file:/data/rdf/update-data1.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:16,代码来源:ClearExamples.java

示例10: loadData

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
/**
 * INSERT DATAの実行に先立ち、データをロードする。
 * 
 * @return ロード後のGraphStore
 */
public static GraphStore loadData() {
    GraphStore graphStore = createGraphStore();
    String cmd = StrUtils.strjoin(" ;\n",
            "LOAD <file:/data/rdf/update-data1.ttl> INTO GRAPH <http://sparqlbook.jp/graph1>",
            "LOAD <file:/data/rdf/update-data1.ttl>"); // default graph
    UpdateAction.parseExecute(cmd, graphStore);
    return graphStore;
}
 
开发者ID:sparql-book,项目名称:sparql-book,代码行数:14,代码来源:InsertDataExamples.java

示例11: ex2

import org.apache.jena.atlas.lib.StrUtils; //导入方法依赖的package包/类
public static void ex2(Dataset dataset)
{
    // Execute a series of operations at once.
    // See ex3 for a better way to build up a request
    // For maximum portability, multiple operations should be separated by a ";".
    // The "\n" imporves readability and parser error messages.
    String cmd = StrUtils.strjoin(" ;\n",
                                  "DROP ALL",
                                  "CREATE GRAPH <http://example/g2>",   // Not needed for most datasets
                                  "LOAD <file:etc/update-data.ttl> INTO GRAPH <http://example/g2>") ;
    // check string created
    System.out.println(cmd) ;
    UpdateAction.parseExecute(cmd, dataset) ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:15,代码来源:UpdateExecuteOperations.java


注:本文中的org.apache.jena.atlas.lib.StrUtils.strjoin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。