本文整理汇总了Java中org.apache.jena.rdf.model.AnonId类的典型用法代码示例。如果您正苦于以下问题:Java AnonId类的具体用法?Java AnonId怎么用?Java AnonId使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnonId类属于org.apache.jena.rdf.model包,在下文中一共展示了AnonId类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addTriple
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
@Override
public void addTriple(CrawleableUri uri, Triple triple) {
String uriString = uri.getUri().toString();
if (rdfData.containsKey(uriString)) {
Model model = rdfData.get(uriString);
Resource s;
Node n = triple.getSubject();
if (n.isBlank()) {
s = model.createResource(new AnonId(triple.getSubject().getBlankNodeId()));
} else {
s = model.createResource(triple.getSubject().getURI());
}
Property p = model.createProperty(triple.getPredicate().getURI());
if (triple.getObject().isURI()) {
model.add(s, p, model.createResource(triple.getObject().getURI()));
} else if (triple.getObject().isBlank()) {
model.add(s, p, model.createResource(new AnonId(triple.getObject().getBlankNodeId())));
} else {
model.add(s, p, triple.getObject().getLiteralValue().toString());
}
} else {
LOGGER.error("Called to add a triple to the URI \"" + uriString + "\" which has never been opened.");
healthyness = false;
}
}
示例2: convertEntityToResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
public Resource convertEntityToResource(IfcEntity entity) {
String namespaceSuffix = entity.getNamespaceSuffix();
if (namespaceSuffix == null) {
namespaceSuffix = "";
}
if (entity.hasName()) {
return jenaModel.createResource(formatModelName(namespaceSuffix + entity.getName()));
} else {
String nodeName = namespaceSuffix + String.format(Ifc2RdfVocabulary.IFC.BLANK_NODE_ENTITY_URI_FORMAT, entity.getLocalId());
if (nameAllBlankNodes) {
return jenaModel.createResource(formatModelBlankNodeName(nodeName));
} else {
return jenaModel.createResource(new AnonId(nodeName));
}
}
}
示例3: convertShortEntityToResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
public Resource convertShortEntityToResource(IfcShortEntity entity, long childNodeCount) {
String namespaceSuffix = entity.getNamespaceSuffix();
if (namespaceSuffix == null) {
namespaceSuffix = "";
}
String nodeName = namespaceSuffix + String.format("%s_%s", entity.getTypeInfo(), entity.getValue());
Resource entityResource;
if (nameAllBlankNodes) {
entityResource = jenaModel.createResource(formatModelBlankNodeName(RegexUtils.getSafeUrl(nodeName)));
} else {
entityResource = jenaModel.createResource(new AnonId(nodeName));
}
entityResource.addProperty(RDF.type, jenaModel.createResource(converter.formatTypeName(entity.getTypeInfo())));
IfcLiteralValue value = entity.getValue();
RDFNode valueNode = convertLiteralValue((IfcLiteralValue) value, entityResource, childNodeCount, jenaModel);
entityResource.addProperty(EXPRESS.hasValue, valueNode);
return entityResource;
}
示例4: rdf4jResourceToJenaResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
private Resource rdf4jResourceToJenaResource(@NonNull Model jenaModel,
@NonNull org.eclipse.rdf4j.model.Resource resource) {
if (resource instanceof SimpleIRI) {
return jenaModel.createResource(resource.stringValue());
} else {
return jenaModel.createResource(new AnonId(resource.stringValue()));
}
}
示例5: anonName
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
protected static String anonName(AnonId id) {
String name = "_:A";
final String sid = id.toString();
for (int i = 0; i < sid.length(); i++) {
final char c = sid.charAt(i);
if (c == 'X') {
name = name + "XX";
} else if (Character.isLetterOrDigit(c)) {
name = name + c;
} else {
name = name + "X" + Integer.toHexString(c) + "X";
}
}
return name;
}
示例6: getSkolemizedResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
private Resource getSkolemizedResource(final IdentifierConverter<Resource, FedoraResource> idTranslator,
final RDFNode resource, final String topic) throws RepositoryException {
final AnonId id = resource.asResource().getId();
if (!skolemizedBnodeMap.containsKey(id)) {
final String base = idTranslator.asString(createResource(topic));
final Resource skolemizedSubject = idTranslator.toDomain(base + "#" + blankNodeIdentifier());
findOrCreateHashUri(idTranslator, skolemizedSubject);
skolemizedBnodeMap.put(id, skolemizedSubject);
}
return skolemizedBnodeMap.get(id);
}
示例7: createAnonResource
import org.apache.jena.rdf.model.AnonId; //导入依赖的package包/类
protected Resource createAnonResource(String anonId) {
return jenaModel.createResource(new AnonId(anonId));
}