本文整理汇总了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;
}
示例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;
}
示例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");
}
示例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());
}
示例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());
}
}
}
示例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;
}
示例7: NewDeviceListener
import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public NewDeviceListener() {
httpAuthenticator = new SimpleAuthenticator(
CONFIG.storeUsername(), CONFIG.storePassword().toCharArray());
}
示例8: SPARQLQueryService
import org.apache.jena.atlas.web.auth.SimpleAuthenticator; //导入依赖的package包/类
public SPARQLQueryService() {
this.httpAuthenticator = new SimpleAuthenticator(config.sparqlUsername(),
config.sparqlPassword().toCharArray());
}
示例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());
}