本文整理汇总了Java中org.apache.jena.ontology.Individual.addLiteral方法的典型用法代码示例。如果您正苦于以下问题:Java Individual.addLiteral方法的具体用法?Java Individual.addLiteral怎么用?Java Individual.addLiteral使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.ontology.Individual
的用法示例。
在下文中一共展示了Individual.addLiteral方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addStackTrace
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
protected void addStackTrace(Individual error, ErrorDocument errorDoc)
throws IOException {
StringBuilder sb = new StringBuilder();
addStackTrace(sb, errorDoc);
if (sb.length() > 0) {
error.addLiteral(provModel.stackTrace, sb.toString());
}
for (T2Reference errRef : errorDoc.getErrorReferences()) {
URI errorURI = URI.create(uriGenerator.makeT2ReferenceURI(errRef
.toUri().toASCIIString()));
Individual nestedErr = provModel.createError(errorURI);
provModel.setWasDerivedFrom(error, nestedErr);
describeEntity(errRef);
}
}
示例2: addKeyPair
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
public void addKeyPair(Individual dictionary, long position,
Individual listItem) {
dictionary.addProperty(hadMember, listItem);
Individual keyPair = model.createIndividual(KeyEntityPair);
keyPair.addProperty(pairEntity, listItem);
keyPair.addLiteral(pairKey, position);
dictionary.addProperty(hadDictionaryMember, keyPair);
}
示例3: setEndedAtTime
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
public Individual setEndedAtTime(Individual endedActivity, Literal time) {
if (time == null) {
logger.warn("Unknown end time");
return null;
}
endedActivity.addLiteral(endedAtTime, time);
Individual end = model.createIndividual(End);
endedActivity.setPropertyValue(qualifiedEnd, end);
end.addLiteral(atTime, time);
return end;
}
示例4: setStartedAtTime
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
public Individual setStartedAtTime(Individual startedActivity, Literal time) {
if (time == null) {
logger.warn("Unknown start time");
return null;
}
startedActivity.addLiteral(startedAtTime, time);
Individual start = model.createIndividual(Start);
startedActivity.setPropertyValue(qualifiedStart, start);
start.addLiteral(atTime, time);
return start;
}
示例5: storeFileReferences
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
protected void storeFileReferences() {
for (Entry<Path, T2Reference> entry : getFileToT2Reference().entrySet()) {
Path file = entry.getKey();
try {
T2Reference t2Ref = entry.getValue();
URI dataURI = URI.create(uriGenerator.makeT2ReferenceURI(t2Ref
.toUri().toASCIIString()));
Individual entity = provModel.createArtifact(dataURI);
String mediaType = saver.getMediaTypes().get(t2Ref);
if (!Files.exists(file)) {
continue;
}
URI contentUri;
if (DataBundles.isReference(file)) {
// TODO: Do we really need to read this back again from the
// file?
contentUri = DataBundles.getReference(file);
} else {
contentUri = toURI(file);
}
Individual content = provModel.setContent(entity, contentUri);
if (mediaType != null) {
mediaTypes.put(contentUri, mediaType);
}
if (!DataBundles.isValue(file)) {
// Don't capture the checksum and content of references and
// lists
continue;
}
// Add checksums
String sha1 = saver.getSha1sums().get(file.toRealPath());
if (sha1 != null) {
content.addLiteral(provModel.sha1, sha1);
}
String sha512 = saver.getSha512sums().get(file.toRealPath());
if (sha512 != null) {
content.addLiteral(provModel.sha512, sha512);
}
long byteCount = Files.size(file);
content.addLiteral(provModel.byteCount, byteCount);
if (byteCount < EMBEDDED_MAX_FILESIZE) {
// Add content if it's "tiny"
byte[] bytes = Files.readAllBytes(file);
if (mediaType != null && mediaType.startsWith(TEXT)) {
// as string - assuming UTF8 (and declaring so)
String str = new String(bytes, UTF8);
content.addLiteral(provModel.chars, str);
content.addLiteral(provModel.characterEncoding,
UTF8.name());
content.addRDFType(provModel.ContentAsText);
} else {
// Or base64-encoded bytes
content.addRDFType(provModel.ContentAsBase64);
content.addLiteral(provModel.bytes, bytes);
}
}
} catch (IOException e) {
logger.warn("Could not read " + file + " as " + UTF8, e);
}
}
}
示例6: addMessageIfNonEmpty
import org.apache.jena.ontology.Individual; //导入方法依赖的package包/类
protected void addMessageIfNonEmpty(Individual error, String message) {
if (message == null || message.isEmpty()) {
return;
}
error.addLiteral(provModel.errorMessage, message);
}