本文整理汇总了Java中org.apache.jena.atlas.logging.Log类的典型用法代码示例。如果您正苦于以下问题:Java Log类的具体用法?Java Log怎么用?Java Log使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Log类属于org.apache.jena.atlas.logging包,在下文中一共展示了Log类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: scanDirectory
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
/**
* Scan a directory for datasource areas.
* These must have a file called source.cfg.
*/
public static Pair<List<Path>/*enabled*/, List<Path>/*disabled*/> scanDirectory(Location serverRoot) {
Path dir = IOX.asPath(serverRoot);
try {
List<Path> directory = ListUtils.toList( Files.list(dir).filter(p->Files.isDirectory(p)).sorted() );
// directory.stream()
// .filter(LocalServer::isFormattedDataSource)
// .collect(Collectors.toList());
List<Path> enabled = directory.stream()
.filter(path -> isEnabled(path))
.collect(Collectors.toList());
List<Path> disabled = directory.stream()
.filter(path -> !isEnabled(path))
.collect(Collectors.toList());
return Pair.create(enabled, disabled);
}
catch (IOException ex) {
Log.error(Cfg.class, "Exception while reading "+dir);
throw IOX.exception(ex);
}
}
示例2: register
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
@Override
final
public RegToken register(Id clientId) {
// Aligned to DeltaLinkHTTP behaviour for testing purpoes.
// Allow multiple registrations.
// It has the effect of swapping the valid RegToken, hence link a client restart
// XXX Rework later.
if ( false && isRegistered() ) {
if ( this.clientId.equals(clientId) ) {
Log.warn(this, "Already registered: "+clientId);
return regToken;
} else {
Log.error(this, "Already registered under a different clientId: "+clientId);
throw new DeltaBadRequestException("Already registered under a different clientId");
}
}
this.clientId = clientId;
regToken = linkMgr.register(clientId);
return regToken;
}
示例3: fromJson
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public static DataSourceDescription fromJson(JsonObject obj) {
String idStr = JSONX.getStrOrNull(obj, F_ID);
if ( idStr == null )
throw new DeltaException("Missing \"id:\" in DataSourceDescription JSON");
String name = JSONX.getStrOrNull(obj, F_NAME);
if ( name == null ) {
@SuppressWarnings("deprecation")
String n = JSONX.getStrOrNull(obj, F_BASE);
// Compatibility.
Log.warn(DataSourceDescription.class, "Deprecated: Use of field name \"base\" - change to \"name\"");
name = n;
}
if ( name == null )
throw new DeltaException("Missing \"name:\" in DataSourceDescription JSON");
String uri = JSONX.getStrOrNull(obj, F_URI);
return new DataSourceDescription(Id.fromString(idStr), name, uri);
}
示例4: UNUSED_CURRENTLY_forkUpdateFetcher
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
private static void UNUSED_CURRENTLY_forkUpdateFetcher(String source, DatasetGraph dsg) {
if ( true ) {
Log.warn(DeltaAssembler.class, "forkUpdateFetcher not set up");
if ( true ) return;
throw new NotImplemented("NEED THE STATE AREA; NEED THE DATASOURCE ID; NEED THE CLIENT ID");
}
DeltaLink dc = DeltaLinkHTTP.connect(source) ;
DeltaConnection client = null;
Runnable r = ()->{
try { client.sync(); }
catch (Exception ex) {
Delta.DELTA_LOG.warn("Failed to sync with the change server: "+ex.getMessage()) ;
// // Delay this task ; extra 3s + the time interval of 2s.
// Dones not work as expected.
// Lib.sleep(5*1000);
}
} ;
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1) ;
executor.scheduleWithFixedDelay(r, 2, 2, TimeUnit.SECONDS) ;
}
示例5: execEvaluated
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
@Override
public QueryIterator execEvaluated(Binding binding, Node subject, Node predicate, Node object, ExecutionContext execCxt) {
Table table = getTable(predicate) ;
if ( table == null ) {
Log.warn(this, "No table for "+SSE.str(predicate));
return IterLib.noResults(execCxt) ;
}
if ( subject.isVariable() ) {
if ( object.isVariable() )
return execVarVar(binding, table, subject, object, execCxt) ;
else
return execVarTerm(binding, table, subject, object, execCxt) ;
} else {
if ( object.isVariable() )
return execTermVar(binding, table, subject, object, execCxt) ;
else
return execTermTerm(binding, table, subject, object, execCxt) ;
}
}
示例6: filter
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
@Override
public Table filter(ExprList expressions, Table table)
{
if ( debug )
{
Log.debug(this,"Restriction") ;
Log.debug(this,expressions.toString()) ;
dump(table) ;
}
QueryIterator iter = table.iterator(execCxt) ;
List<Binding> output = new ArrayList<Binding>() ;
for ( ; iter.hasNext() ; )
{
Binding b = iter.nextBinding() ;
if ( expressions.isSatisfied(b, execCxt) )
output.add(b) ;
}
return new TableN(new QueryIterPlainWrapper(output.iterator(), execCxt)) ;
}
示例7: loadVocabularies
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
@Override
public void loadVocabularies() {
QuerySolutionMap binding = new QuerySolutionMap();
binding.add("linkset", this.dataset);
Query query = QueryFactory.create(linksetVocabularyQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidInstance.getVoidModel(),
binding);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource vocabulary = soln.getResource("vocabulary").as(
OntResource.class);
vocabularies.add(vocabulary);
}
} catch (Exception e) {
Log.debug(Linkset.class, "Failed linksetVocabularyQuery");
Log.debug(Linkset.class, e.getStackTrace().toString());
} finally {
qexec.close();
}
}
示例8: transform
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public Op transform(RemediatorQuery remediatorQuery) {
if (OpBGP.isBGP(remediatorQuery.getSimplifiedOperations())) {
{
DatasetQueryVarLinksets linksetOpServices;
originalClause = BGPToClause((OpBGP) remediatorQuery.getSimplifiedOperations());
rewriteBGP(originalClause);
voidModel.InferVariableClasses(globalQueryVars);
globalQueryVars.locateDatasetClauses(datasets);
linksetOpServices=linksets.createLinksetQueryClauses(globalQueryVars);
if (optimize && ! voidModel.getPartitionStatisticsAvailable()){
Log.warn(this, "Statistics not queried nor read so optimization of query plan not avaiable. Heuristic will be used instead");
this.optimize=false;
}
queryPlan = new QueryPlan(globalQueryVars, optimize);
//datasets.createDatasetQueryClauses(remediatorQuery, globalQueryVars);
return createOpSequence(linksetOpServices);
}
} else {
Log.warn(this, "Can only transform BGPs " + remediatorQuery.getSimplifiedOperations().toString());
return null;
}
}
示例9: mergeToBGP
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
private Op mergeToBGP(Op left, Op right) {
BasicPattern bgp = new BasicPattern();
if (OpBGP.isBGP(left)) {
bgp.addAll(((OpBGP) left).getPattern());
} else {
if (!(left instanceof OpTable))
Log.warn(this, "mergeToBGP left not valid BGP " + left.toString());
}
if (OpBGP.isBGP(right)) {
bgp.addAll(((OpBGP) right).getPattern());
;
} else {
if (!(right instanceof OpTable))
Log.warn(this, "mergeToBGP right not valid BGP"+ right.toString());
}
return new OpBGP(bgp);
}
示例10: initializeModel
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
private void initializeModel(String voidURI, Boolean gatherStatistics)
throws URISyntaxException {
if (this.workspace.getPhysicalURI(new URI(voidURI)) != null) {
statisticsModel = ModelFactory.createOntologyModel();
buildVoidModel(voidURI, gatherStatistics);
try {
conjunctiveClauses = parser.getClauses(this
.writeVocabularyModel(), this.getWorkspace()
.getOWLOntologyURIMapper());
} catch (Exception e) {
Log.fatal(this, "Failed to parse clauses: " + e.getMessage());
}
} else {
throw new URISyntaxException(voidURI, "Invalid or empty voidURI");
}
}
示例11: loadClassPartitionStatistics
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public void loadClassPartitionStatistics(OntModel voidModel) {
Query query = QueryFactory.create(classPartitionStatisticsQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource dataset = soln.getResource("Dataset").as(
OntResource.class);
OntResource clazz = soln.getResource("Class").as(
OntResource.class);
Integer entities = (soln.getLiteral("Entities") != null) ? soln
.getLiteral("Entities").getInt() : null;
Dataset ds = this.getDataset(dataset);
if (ds!=null)ds.getPartitions().addClassPartition(clazz, entities);
}
} catch (Exception e) {
Log.debug(
this,
"Unable to execute classPartitionStatisticsQuery " + query);
} finally {
qexec.close();
}
}
示例12: loadPropertyPartitionStatistics
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public void loadPropertyPartitionStatistics(OntModel voidModel) {
Query query = QueryFactory.create(propertyPartitionStatisticsQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource dataset = soln.getResource("Dataset").as(
OntResource.class);
OntResource property = soln.getResource("Property").as(
OntResource.class);
Integer triples = (soln.getLiteral("Triples") != null) ? soln
.getLiteral("Triples").getInt() : null;
Dataset ds = this.getDataset(dataset);
if (ds!=null)ds.getPartitions().addPropertyPartition(property, triples);
}
} catch (Exception e) {
Log.debug(
this,
"Unable to execute propertyPartitionStatisticsQuery " + query);
} finally {
qexec.close();
}
}
示例13: loadVocabularies
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public void loadVocabularies() {
QuerySolutionMap binding = new QuerySolutionMap();
binding.add("dataset", dataset);
Query query = QueryFactory.create(datasetVocabularyQuery);
QueryExecution qexec = QueryExecutionFactory.create(query, voidInstance.getVoidModel(),
binding);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource vocabulary = soln.getResource("vocabulary").as(
OntResource.class);
vocabularies.add(vocabulary);
}
} catch (Exception e) {
Log.debug(Dataset.class, "Failed datasetVocabularyQuery");
Log.debug(Dataset.class, e.getStackTrace().toString());
} finally {
qexec.close();
}
}
示例14: updatePartitions
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
public void updatePartitions() {
//Use OntModelSpec.OWL_MEM_RDFS_INF to ensure all default classes and properties are also discovered.
OntModelSpec partitionModelSpec = new OntModelSpec(OntModelSpec.OWL_MEM_RDFS_INF);
partitionModelSpec.setDocumentManager(voidInstance.getVoidModel().getDocumentManager());
partitionModelSpec.getDocumentManager().setProcessImports(true);
OntModel partitionModel = ModelFactory
.createOntologyModel(partitionModelSpec);
for (OntResource vocabulary : this.getVocabularies()) {
try {
partitionModel.read(vocabulary.getURI());
} catch (Exception e) {
Log.debug(Void.class, "Failed to locate dataset vocabulary: "
+ vocabulary + " " + e.getMessage());
}
}
updateClassPartition(partitionModel);
updatePropertyPartition(partitionModel);
}
示例15: updateClassPartition
import org.apache.jena.atlas.logging.Log; //导入依赖的package包/类
private void updateClassPartition(OntModel partitionModel) {
Query query = QueryFactory.create(classPartitionQuery);
QueryExecution qexec = QueryExecutionFactory.create(query,
partitionModel);
try {
ResultSet results = qexec.execSelect();
for (; results.hasNext();) {
QuerySolution soln = results.nextSolution();
OntResource clazz = soln.getResource("class").as(
OntResource.class);
if (!clazz.isAnon()) partitions.addClassPartition(clazz, null);
}
} catch (Exception e) {
Log.debug(Dataset.class, "Failed to execute classPartitionQuery");
} finally {
qexec.close();
}
}