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


Java SimpleAuthenticator类代码示例

本文整理汇总了Java中org.apache.jena.atlas.web.auth.SimpleAuthenticator的典型用法代码示例。如果您正苦于以下问题:Java SimpleAuthenticator类的具体用法?Java SimpleAuthenticator怎么用?Java SimpleAuthenticator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleAuthenticator类属于org.apache.jena.atlas.web.auth包,在下文中一共展示了SimpleAuthenticator类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: readTriplesFromKs

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public static ArrayList<Statement> readTriplesFromKs(String subjectUri, String sparqlQuery){

        ArrayList<Statement> triples = new ArrayList<Statement>();
        HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());
        try {
            qCount++;
            QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
            ResultSet resultset = x.execSelect();
            while (resultset.hasNext()) {
                QuerySolution solution = resultset.nextSolution();
                String relString = solution.get("predicate").toString();
                RDFNode obj = solution.get("object");
                Model model = ModelFactory.createDefaultModel();
                Resource subj = model.createResource(subjectUri);
                Statement s = createStatement(subj, ResourceFactory.createProperty(relString), obj);
                triples.add(s);
            }
        } catch (Exception e) {
            //e.printStackTrace();
        }
        return triples;
    }
 
开发者ID:cltl,项目名称:EventCoreference,代码行数:23,代码来源:TrigKSTripleReader.java

示例2: readEventIdsFromKs

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public static ArrayList<String> readEventIdsFromKs(String sparqlQuery)throws Exception {
    ArrayList<String> eventIds = new ArrayList<String>();
    //System.out.println("serviceEndpoint = " + serviceEndpoint);
    //System.out.println("sparqlQuery = " + sparqlQuery);
    //System.out.println("user = " + user);
    //System.out.println("pass = " + pass);
    HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());

    QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
    ResultSet resultset = x.execSelect();
    while (resultset.hasNext()) {
        QuerySolution solution = resultset.nextSolution();
        //System.out.println("solution.toString() = " + solution.toString());
        //( ?event = <http://www.newsreader-project.eu/data/Dasym-Pilot/425819_relink_dominant.naf#ev24> )
        String currentEvent = solution.get("event").toString();
        //System.out.println("currentEvent = " + currentEvent);
        //http://www.newsreader-project.eu/data/Dasym-Pilot/425819_relink_dominant.naf#ev24
        if (!eventIds.contains(currentEvent)) {
            eventIds.add(currentEvent);
        }
    }
    return eventIds;
}
 
开发者ID:cltl,项目名称:EventCoreference,代码行数:24,代码来源:TrigKSTripleReader.java

示例3: CSPARQL

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public CSPARQL() {
  engine = new CsparqlEngineImpl();
  stream = new RdfStream(STREAM_URI);
  engine.initialize();
  engine.registerStream(stream);
  queries = new HashMap<>();
  httpAuthenticator = new SimpleAuthenticator(config.storeUsername(),
      config.storePassword().toCharArray());
  logger.info("C-SPARQL is initialized");
}
 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:11,代码来源:CSPARQL.java

示例4: RDFStore

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public RDFStore(Configuration configuration) {
  this.configuration = configuration;
  httpAuthenticator = new SimpleAuthenticator(
      configuration.getAsString(Keys.TRIPLESTORE_USERNAME),
      configuration.getAsString(Keys.TRIPLESTORE_PASSWORD).toCharArray());

  ps.buffer(
      configuration.getAsInteger(Keys.STORE_OPERATION_BUFFERIDLE), TimeUnit.SECONDS,
      configuration.getAsInteger(Keys.STORE_OPERATION_BUFFERSIZE))
      .subscribe(new BatchUploader());
}
 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:12,代码来源:RDFStore.java

示例5: inferIdentityRelations

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
private static void inferIdentityRelations(String sparqlQuery, boolean matchILI, boolean matchLemma, boolean matchMultiple, int iliSize, Node eventId, DatasetGraph g) {
    if (matchILI || matchLemma) {
        sparqlQuery += "GROUP BY ?ev";
    }
    HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());
    QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
    ResultSet resultset = x.execSelect();
    int threshold;
    while (resultset.hasNext()) {
        QuerySolution solution = resultset.nextSolution();
        if (matchILI || matchLemma) {
            if (matchILI)
                threshold = conceptMatchThreshold;
            else
                threshold=phraseMatchThreshold;

            if (matchMultiple) {
                //System.out.println(solution);
                if (checkIliLemmaThreshold(iliSize, solution.get("conceptcount").asLiteral().getInt(), solution.get("myconceptcount").asLiteral().getInt(), threshold)) {
                    insertIdentity(g, eventId, solution.get("ev").asNode());
                }
            } else {
                if (checkIliLemmaThreshold(1, solution.get("conceptcount").asLiteral().getInt(), 1, threshold)) {
                    insertIdentity(g, eventId, solution.get("ev").asNode());
                }
            }
        } else {
            insertIdentity(g, eventId, solution.get("ev").asNode());
        }
    }
}
 
开发者ID:newsreader,项目名称:StreamEventCoreference,代码行数:32,代码来源:ProcessEventObjectsStream.java

示例6: inferMultitimesIdentityRelations

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
private static ArrayList<Node> inferMultitimesIdentityRelations (String sparqlQuery, boolean matchILI, boolean matchLemma, boolean matchMultiple, int iliSize, String eventId) {
    if (matchILI || matchLemma) {
        sparqlQuery += "GROUP BY ?ev";
    }
    HttpAuthenticator authenticator = new SimpleAuthenticator(user, pass.toCharArray());
    QueryExecution x = QueryExecutionFactory.sparqlService(serviceEndpoint, sparqlQuery, authenticator);
    ResultSet resultset = x.execSelect();
    int threshold;
    ArrayList<Node> rslt = new ArrayList<Node>();
    while (resultset.hasNext()) {
        QuerySolution solution = resultset.nextSolution();
        if (matchILI || matchLemma) {
            if (matchILI)
                threshold = conceptMatchThreshold;
            else
                threshold=phraseMatchThreshold;

            if (matchMultiple) {
                //System.out.println(solution);
                if (checkIliLemmaThreshold(iliSize, solution.get("conceptcount").asLiteral().getInt(), solution.get("myconceptcount").asLiteral().getInt(), threshold)) {
                    rslt.add(solution.get("ev").asNode());
                }
            } else {
                if (checkIliLemmaThreshold(1, solution.get("conceptcount").asLiteral().getInt(), 1, threshold)) {
                    rslt.add(solution.get("ev").asNode());
                }
            }
        } else {
            rslt.add(solution.get("ev").asNode());
        }
    }
    return rslt;
}
 
开发者ID:newsreader,项目名称:StreamEventCoreference,代码行数:34,代码来源:ProcessEventObjectsStream.java

示例7: NewDeviceListener

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public NewDeviceListener() {
  httpAuthenticator = new SimpleAuthenticator(
      CONFIG.storeUsername(), CONFIG.storePassword().toCharArray());
}
 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:5,代码来源:NewDeviceListener.java

示例8: SPARQLQueryService

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public SPARQLQueryService() {
  this.httpAuthenticator = new SimpleAuthenticator(config.sparqlUsername(),
      config.sparqlPassword().toCharArray());
}
 
开发者ID:semiotproject,项目名称:semiot-platform,代码行数:5,代码来源:SPARQLQueryService.java

示例9: Store

import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public Store(final String endpoint) {
    this.endpoint = endpoint;
    this.authenticator = new SimpleAuthenticator(
            CONFIG.sparqlUpdateUsername(),
            CONFIG.sparqlUpdatePassword().toCharArray());
}
 
开发者ID:ailabitmo,项目名称:DAAFSE,代码行数:7,代码来源:Store.java


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