本文整理汇总了Java中org.openrdf.model.Statement.getPredicate方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.getPredicate方法的具体用法?Java Statement.getPredicate怎么用?Java Statement.getPredicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openrdf.model.Statement
的用法示例。
在下文中一共展示了Statement.getPredicate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDbInfo
import org.openrdf.model.Statement; //导入方法依赖的package包/类
public static DbInfo getDbInfo( Resource id, RepositoryConnection rc )
throws RepositoryException {
DbInfo dbi = new DbInfo();
for ( Statement stmt : Iterations.asList( rc.getStatements( id, null, null, false ) ) ) {
URI pred = stmt.getPredicate();
String val = stmt.getObject().stringValue();
if ( DATA_PREDICATE.equals( pred ) ) {
dbi.setDataUrl( val );
}
else if ( INSIGHTS_PREDICATE.equals( pred ) ) {
dbi.setInsightsUrl( val );
}
else if ( RDFS.LABEL.equals( pred ) ) {
dbi.setName( val );
}
}
return dbi;
}
示例2: getUser
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private static User getUser( Resource id, RepositoryConnection rc )
throws RepositoryException {
LinkedHashModel model = new LinkedHashModel( Iterations.asList(
rc.getStatements( id, null, null, false ) ) );
org.openrdf.model.Model namer = model.filter( id, FOAF.ACCOUNT, null );
RemoteUserImpl user = new RemoteUserImpl( namer.objectString() );
model.removeAll( namer );
for ( Statement stmt : model ) {
URI pred = stmt.getPredicate();
String val = stmt.getObject().stringValue();
for ( Map.Entry<UserProperty, URI> en : PROPMAP.entrySet() ) {
if ( en.getValue().equals( pred ) ) {
user.setProperty( en.getKey(), val );
}
}
}
return user;
}
示例3: getCopier
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private static RepositoryCopier getCopier( RepositoryConnection conn,
Map<URI, URI> fromto, URI schema, URI data ) {
final UriBuilder owlb = UriBuilder.getBuilder( schema );
final UriBuilder datab = UriBuilder.getBuilder( data );
return new RepositoryCopier( conn ) {
@Override
public void handleStatement( Statement stmt ) throws RDFHandlerException {
URI sub = URI.class.cast( stmt.getSubject() );
URI pred = stmt.getPredicate();
Value obj = stmt.getObject();
sub = upgrade( sub, fromto, owlb, datab );
pred = upgrade( pred, fromto, owlb, datab );
if ( obj instanceof URI ) {
obj = upgrade( URI.class.cast( obj ), fromto, owlb, datab );
}
super.handleStatement( new StatementImpl( sub, pred, obj ) );
}
};
}
示例4: getValueAt
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Gets the cell value at a particular row and column index.
*
* @param r Row index.
* @param c Column index.
*
* @return Object Cell value.
*/
@Override
public Object getValueAt( int r, int c ) {
Statement row = rows.get( r );
switch ( c ) {
case 0: {
return row.getPredicate();
}
case 1: {
return RDFDatatypeTools.getDatatype( row.getObject() );
}
case 2: {
return row.getObject();
}
default:
return null;
}
}
示例5: writeStatement
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Write a {@link Statement} to a {@link String}
*
* @param statement
* the {@link Statement} to write
* @return a {@link String} representation of the statement
*/
public static String writeStatement(Statement statement) {
Resource subject = statement.getSubject();
Resource context = statement.getContext();
URI predicate = statement.getPredicate();
Value object = statement.getObject();
Validate.notNull(subject);
Validate.notNull(predicate);
Validate.notNull(object);
String s = "";
if (context == null) {
s = SEP + subject.toString() + SEP + predicate.toString() + SEP + object.toString();
} else {
s = context.toString() + SEP + subject.toString() + SEP + predicate.toString() + SEP + object.toString();
}
return s;
}
示例6: map
import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Override
public Value[] map(final Statement statement) throws RDFHandlerException {
final String message = "Multiple annotation IDs in same statement";
Value key = null;
if (match(statement.getSubject())) {
key = statement.getSubject();
}
if (match(statement.getContext())) {
Preconditions.checkArgument(key == null, message);
key = statement.getContext();
}
if (match(statement.getObject())) {
Preconditions.checkArgument(key == null, message);
key = statement.getObject();
}
if (match(statement.getPredicate())) {
Preconditions.checkArgument(key == null, message);
key = statement.getPredicate();
}
if (key == null) {
key = Mapper.BYPASS_KEY;
}
return new Value[] { key };
}
示例7: skolemize
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private Statement skolemize(final Statement statement) {
boolean skolemized = false;
Resource subj = statement.getSubject();
if (subj instanceof BNode) {
subj = skolemize((BNode) subj);
skolemized = true;
}
Value obj = statement.getObject();
if (obj instanceof BNode) {
obj = skolemize((BNode) obj);
skolemized = true;
}
if (skolemized) {
final URI pred = statement.getPredicate();
return Data.getValueFactory().createStatement(subj, pred, obj);
}
return statement;
}
示例8: rewriteStatement
import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Nullable
Statement rewriteStatement(@Nullable final Statement statement) {
if (statement == null) {
return null;
}
final Resource oldSubj = statement.getSubject();
final URI oldPred = statement.getPredicate();
final Value oldObj = statement.getObject();
final Resource oldCtx = statement.getContext();
final Resource newSubj = rewriteValue(oldSubj);
final URI newPred = rewriteValue(oldPred);
final Value newObj = rewriteValue(oldObj);
final Resource newCtx = rewriteValue(oldCtx);
if (oldSubj == newSubj && oldPred == newPred && oldObj == newObj && oldCtx == newCtx) {
return statement;
} else if (newCtx != null) {
return Data.getValueFactory().createStatement(newSubj, newPred, newObj, newCtx);
} else {
return Data.getValueFactory().createStatement(newSubj, newPred, newObj);
}
}
示例9: applyRuleX1
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleX1()
throws SailException
{
int nofInferred = 0;
String prefix = RDF.NAMESPACE + "_";
Iterator<Statement> iter = this.newThisIteration.match(null, null, null);
while (iter.hasNext()) {
Statement st = iter.next();
URI predNode = st.getPredicate();
String predURI = predNode.toString();
if (predURI.startsWith(prefix) && isValidPredicateNumber(predURI.substring(prefix.length()))) {
boolean added = addInferredStatement(predNode, RDF.TYPE, RDFS.CONTAINERMEMBERSHIPPROPERTY);
if (added) {
nofInferred++;
}
}
}
return nofInferred;
}
示例10: _getPredicateIds
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private static Set<URI> _getPredicateIds(Set<Statement> statements,
URI subject, URI type) {
if (subject == null)
return Collections.emptySet();
Set<URI> ret = new HashSet<URI>();
for (Statement statement : statements) {
Resource s = statement.getSubject();
if (!s.equals(subject))
continue;
URI p = statement.getPredicate();
if (type != null) {
if (_getTypes(statements, p).contains(type))
ret.add(p);
} else {
ret.add(p);
}
}
return ret;
}
示例11: storeStatement
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Stores types and predicates occoring with the current subject.
*
* @param st the Statement to process.
*/
private void storeStatement(Statement st) {
URI predicate = st.getPredicate();
Value object = st.getObject();
// check for type statement
if (RDF.TYPE.equals(predicate)) {
typesOfCurrentSubject.add((URI) object);
count(totalTypeCounts, (URI) object);
} else {
predsOfCurrentSubject.add(predicate);
count(totalPredCounts, predicate);
}
lastSubject = st.getSubject();
}
示例12: loadPerspective
import org.openrdf.model.Statement; //导入方法依赖的package包/类
private static Perspective loadPerspective( URI perspectiveURI, RepositoryConnection rc,
UriBuilder urib ) {
try {
Perspective perspective = new Perspective( perspectiveURI );
Collection<Statement> stmts
= Iterations.asList( rc.getStatements( perspectiveURI, null, null, false ) );
for ( Statement s : stmts ) {
URI pred = s.getPredicate();
Value val = s.getObject();
if ( val instanceof Literal ) {
if ( RDFS.LABEL.equals( pred ) ) {
perspective.setLabel( val.stringValue() );
}
else if ( DCTERMS.DESCRIPTION.equals( pred ) ) {
perspective.setDescription( val.stringValue() );
}
}
}
perspective.setInsights( loadInsights( perspective, rc, urib ) );
return perspective;
}
catch ( RepositoryException e ) {
log.error( e, e );
}
throw new IllegalArgumentException( "unknown perspective: " + perspectiveURI );
}
示例13: queryAll
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Handles all results of a query. Closes the query iterator when done.
* @param statement the {@link Statement} to query for. (not {@code null})
* @param rdfStatementHandler the {@link RDFHandler} to use for handling
* each statement returned. (not {@code null})
* @throws QueryEvaluationException
*/
public void queryAll(final Statement statement, final RDFHandler rdfStatementHandler) throws QueryEvaluationException {
final Resource subject = statement.getSubject();
final URI predicate = statement.getPredicate();
final Value object = statement.getObject();
final Resource context = statement.getContext();
queryAll(subject, predicate, object, rdfStatementHandler, context);
}
示例14: queryFirst
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* Handles only the first result of a query. Closes the query iterator when
* done.
* @param statement the {@link Statement} to query for. (not {@code null})
* @param rdfStatementHandler the {@link RDFHandler} to use for handling the
* first statement returned. (not {@code null})
* @throws QueryEvaluationException
*/
public void queryFirst(final Statement statement, final RDFHandler rdfStatementHandler) throws QueryEvaluationException {
checkNotNull(statement);
final Resource subject = statement.getSubject();
final URI predicate = statement.getPredicate();
final Value object = statement.getObject();
final Resource context = statement.getContext();
queryFirst(subject, predicate, object, rdfStatementHandler, context);
}
示例15: applyRuleN1b
import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
* aaa xxx bbb
* xxx nrl:inverseProperty yyy
* -->
* bbb yyy aaa
* @return
* @throws SailException
*/
private int applyRuleN1b()
throws SailException
{
int nofInferred = 0;
Iterator<Statement> ntIter = this.newThisIteration.match(null, null, null);
while (ntIter.hasNext()) {
Statement nt = ntIter.next();
Resource xxx = nt.getPredicate();
CloseableIteration<? extends Statement, SailException> t1Iter;
t1Iter = getWrappedConnection().getStatements(xxx,NRL_InverseProperty, null, true);
while (t1Iter.hasNext()) {
Statement t1 = t1Iter.next();
Value yyy = t1.getObject();
if (yyy instanceof URI) {
Resource aaa = nt.getSubject();
Value bbb = nt.getObject();
boolean added = addInferredStatement((Resource)bbb, (URI) yyy, aaa);
if (added) {
nofInferred++;
}
}
}
t1Iter.close();
}
return nofInferred;
}