本文整理了Java中org.apache.commons.rdf.api.RDF.createIRI
方法的一些代码示例,展示了RDF.createIRI
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RDF.createIRI
方法的具体详情如下:
包路径:org.apache.commons.rdf.api.RDF
类名称:RDF
方法名:createIRI
[英]Create an IRI from a (possibly escaped) String. The provided iri string MUST be valid according to the W3C RDF-1.1 IRI definition.
[中]从(可能转义的)字符串创建IRI。根据W3C RDF-1.1 IRI定义,提供的iri字符串必须有效。
代码示例来源:origin: org.apache.commons/commons-rdf-api
@Override
public IRI getDatatype() {
return factory.createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#langString");
}
@Override
代码示例来源:origin: org.trellisldp.ext/trellis-db
private static RDFTerm getObject(final String value, final String lang, final String datatype) {
if (nonNull(lang)) {
return rdf.createLiteral(value, lang);
} else if (nonNull(datatype)) {
return rdf.createLiteral(value, rdf.createIRI(datatype));
}
return rdf.createIRI(value);
}
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public void setDefaultTermType() {
/*
* An object map's default term termMapType is Literal if it's column valued,
* has a language tag, or if it's data typed.
*/
if (termMapType == TermMapType.COLUMN_VALUED || langTag != null || dataType != null) {
termTypeIRI = getRDF().createIRI(R2RMLVocabulary.TERM_LITERAL);
} else {
termTypeIRI = getRDF().createIRI(R2RMLVocabulary.TERM_IRI);
}
}
代码示例来源:origin: org.trellisldp/trellis-rosid-file
/**
* Write the resource data into a file as JSON
* @param directory the directory
* @param identifier the resource identifier
* @return true if the write operation succeeds
*/
public static Boolean write(final File directory, final String identifier) {
return write(directory, rdf.createIRI(identifier));
}
代码示例来源:origin: org.trellisldp/trellis-rosid-file
/**
* Read the state of the resource data at a particular point in time
* @param directory the directory
* @param identifier the identifier
* @param time the time
* @return the resource data, if it exists
*/
public static Optional<ResourceData> read(final File directory, final String identifier, final Instant time) {
return read(directory, rdf.createIRI(identifier), time);
}
代码示例来源:origin: ontop/ontop
/**
*
* table IRI:
* the relative IRI consisting of the percent-encoded form of the table name.
*
* @return table IRI
*/
private IRI getTableIRI(RelationID tableId) {
return rdfFactory.createIRI(baseIRI + R2RMLIRISafeEncoder.encode(tableId.getTableName()));
}
代码示例来源:origin: ontop/ontop
@Override
public DataPropertyAssertion createDataPropertyAssertion(String dp, ObjectConstant o, ValueConstant v) throws InconsistentOntologyException {
return OntologyBuilderImpl.createDataPropertyAssertion(new DataPropertyExpressionImpl(rdfFactory.createIRI(dp)), o, v);
}
};
代码示例来源:origin: org.trellisldp/trellis-api
/**
* Skolemize a blank node.
*
* @param term the RDF term
* @return a skolemized node, if a blank node; otherwise the original term
*/
default RDFTerm skolemize(final RDFTerm term) {
if (term instanceof BlankNode) {
return getInstance().createIRI(TRELLIS_BNODE_PREFIX + ((BlankNode) term).uniqueReference());
}
return term;
}
代码示例来源:origin: org.trellisldp/trellis-test
/**
* Check an event graph for required properties.
* @param resource the resource IRI
* @param agent the agent IRI
* @param activity the activity IRI
* @param ldpType the LDP type of the resource
* @return a predicate function
*/
public static Predicate<Graph> checkEventGraph(final String resource, final String agent, final IRI activity,
final IRI ldpType) {
return checkEventGraph(resource, getInstance().createIRI(agent), activity, ldpType);
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public Set<Triple> serialize() {
Set<Triple> stmtSet = new HashSet<>();
stmtSet.addAll(super.serialize());
stmtSet.add(getRDF().createTriple(
getNode(),
getRDF().createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
getRDF().createIRI(R2RMLVocabulary.TYPE_GRAPH_MAP)));
return stmtSet;
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public Set<Triple> serialize() {
Set<Triple> stmtSet = new HashSet<>();
stmtSet.addAll(super.serialize());
stmtSet.add(getRDF().createTriple(getNode(),
getRDF().createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
getRDF().createIRI(R2RMLVocabulary.TYPE_PREDICATE_MAP)));
return stmtSet;
}
代码示例来源:origin: org.trellisldp.ext/trellis-db
public static Optional<BinaryMetadata> getBinaryMetadata(final IRI ixnModel, final String location,
final String format) {
if (LDP.NonRDFSource.equals(ixnModel) && nonNull(location)) {
return of(BinaryMetadata.builder(rdf.createIRI(location)).mimeType(format).build());
}
return empty();
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public void setDatatype(IRI datatypeURI) {
if (termTypeIRI.equals(getRDF().createIRI(R2RMLVocabulary.TERM_LITERAL))) {
dataType = datatypeURI;
removeLanguageTag();
} else {
throw new IllegalStateException("The term termMapType is " + termTypeIRI
+ ". Should be " + R2RMLVocabulary.TERM_LITERAL + ".");
}
}
代码示例来源:origin: org.trellisldp.ext/trellis-db
/**
* Fetch a stream of the audit-related quads.
*/
private Stream<Quad> fetchAuditQuads() {
final String query = "SELECT subject, predicate, object, lang, datatype FROM log WHERE id = ?";
return jdbi.withHandle(handle -> handle.select(query, getIdentifier().getIRIString())
.map((rs, ctx) -> rdf.createQuad(Trellis.PreferAudit, rdf.createIRI(rs.getString(SUBJECT)),
rdf.createIRI(rs.getString(PREDICATE)),
getObject(rs.getString(OBJECT), rs.getString(LANG), rs.getString(DATATYPE))))
.stream());
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public Set<Triple> serialize() {
Set<Triple> stmtSet = new HashSet<Triple>();
stmtSet.add(getRDF().createTriple(node, getRDF().createIRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"), getRDF().createIRI(R2RMLVocabulary.TYPE_BASE_TABLE_OR_VIEW)));
stmtSet.add(getRDF().createTriple(node, getRDF().createIRI(R2RMLVocabulary.PROP_TABLE_NAME),
getRDF().createLiteral(getTableName())));
return stmtSet;
}
代码示例来源:origin: ontop/ontop
private boolean isNumeric(ValueConstant constant) {
String constantValue = constant.getValue();
RDFDatatype type = typeFactory.getDatatype(rdfFactory.createIRI(constantValue));
return type.isA(OntopInternal.NUMERIC);
}
代码示例来源:origin: org.trellisldp/trellis-rosid-file
@Override
public Optional<Binary> getBinary() {
return ofNullable(data.getBinary()).map(binary ->
new Binary(rdf.createIRI(binary.getId()), binary.getModified(), binary.getFormat(), binary.getSize()));
}
代码示例来源:origin: eu.optique-project/r2rml-api-core
@Override
public void setTermType(IRI typeIRI) {
super.setTermType(typeIRI);
if (!typeIRI.equals(getRDF().createIRI(R2RMLVocabulary.TERM_LITERAL))) {
removeLanguageTag();
removeDatatype();
}
}
代码示例来源:origin: ontop/ontop
private IRIConstant getIndividual(OWLIndividual ind) throws TranslationException {
if (ind.isAnonymous())
throw new OWLAPITranslatorOWL2QL.TranslationException("Found anonymous individual, this feature is not supported:" + ind);
return termFactory.getConstantIRI(rdfFactory.createIRI(ind.asOWLNamedIndividual().getIRI().toString()));
}
代码示例来源:origin: org.apache.commons/commons-rdf-api
@Test
public void hashCodeTriple() throws Exception {
final IRI iri = factory.createIRI("http://example.com/");
final Triple triple = factory.createTriple(iri, iri, iri);
assertEquals(Objects.hash(iri, iri, iri), triple.hashCode());
}
内容来源于网络,如有侵权,请联系作者删除!