当前位置: 首页>>代码示例>>Java>>正文


Java Statement.getSubject方法代码示例

本文整理汇总了Java中org.openrdf.model.Statement.getSubject方法的典型用法代码示例。如果您正苦于以下问题:Java Statement.getSubject方法的具体用法?Java Statement.getSubject怎么用?Java Statement.getSubject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openrdf.model.Statement的用法示例。


在下文中一共展示了Statement.getSubject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getId

import org.openrdf.model.Statement; //导入方法依赖的package包/类
public static Resource getId( DbInfo t, RepositoryConnection rc )
		throws RepositoryException {
	List<Statement> stmts = Iterations.asList( rc.getStatements( null, RDF.TYPE,
			WEBDS.DBINFO, false ) );
	Resource idToRemove = null;
	for ( Statement s : stmts ) {
		Resource sbj = s.getSubject();
		List<Statement> individuals
				= Iterations.asList( rc.getStatements( sbj, RDFS.LABEL, null, false ) );
		for ( Statement ind : individuals ) {
			if ( ind.getObject().stringValue().equals( t.getName() ) ) {
				idToRemove = sbj;
			}
		}
	}

	return idToRemove;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:19,代码来源:DbInfoMapper.java

示例2: getId

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private static Resource getId( User t, RepositoryConnection rc )
		throws RepositoryException {
	List<Statement> stmts = Iterations.asList( rc.getStatements( null, RDF.TYPE,
			FOAF.PERSON, false ) );
	Resource idToRemove = null;
	for ( Statement s : stmts ) {
		Resource sbj = s.getSubject();
		List<Statement> individuals
				= Iterations.asList( rc.getStatements( sbj, FOAF.ACCOUNT, null, false ) );
		for ( Statement ind : individuals ) {
			if ( ind.getObject().stringValue().equals( t.getUsername() ) ) {
				idToRemove = sbj;
			}
		}
	}

	return idToRemove;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:19,代码来源:UserMapper.java

示例3: applyRuleRdfs8

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs8()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> iter = this.newThisIteration.match(null, RDF.TYPE, RDFS.CLASS);

	while (iter.hasNext()) {
		Statement st = iter.next();

		Resource xxx = st.getSubject();

		boolean added = addInferredStatement(xxx, RDFS.SUBCLASSOF, RDFS.RESOURCE);
		if (added) {
			nofInferred++;
		}
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:21,代码来源:ForwardChainingRDFSInferencerConnection.java

示例4: applyRuleRdfs10

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs10()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> iter = this.newThisIteration.match(null, RDF.TYPE, RDFS.CLASS);

	while (iter.hasNext()) {
		Statement st = iter.next();

		Resource xxx = st.getSubject();

		boolean added = addInferredStatement(xxx, RDFS.SUBCLASSOF, xxx);
		if (added) {
			nofInferred++;
		}
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:21,代码来源:ForwardChainingRDFSInferencerConnection.java

示例5: applyRuleRdfs13

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs13()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> iter = this.newThisIteration.match(null, RDF.TYPE, RDFS.DATATYPE);

	while (iter.hasNext()) {
		Statement st = iter.next();

		Resource xxx = st.getSubject();

		boolean added = addInferredStatement(xxx, RDFS.SUBCLASSOF, RDFS.LITERAL);
		if (added) {
			nofInferred++;
		}
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:21,代码来源:ForwardChainingRDFSInferencerConnection.java

示例6: 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);
    }
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:26,代码来源:RewritingTripleStore.java

示例7: 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 };
}
 
开发者ID:dkmfbk,项目名称:pikes,代码行数:25,代码来源:ProcessorASNorm.java

示例8: updateLastModifiedDate

import org.openrdf.model.Statement; //导入方法依赖的package包/类
public static void updateLastModifiedDate( RepositoryConnection rc,
		Resource baseuri ) {
	// updates the base uri's last modified key
	// 1) if we don't know it already, figure out what our base uri is
	// 2) remove any last modified value
	// 3) add the new last modified value

	ValueFactory vf = rc.getValueFactory();
	try {
		if ( null == baseuri ) {
			RepositoryResult<Statement> rr = rc.getStatements( null, RDF.TYPE,
					SEMTOOL.Database, false );
			List<Statement> stmts = Iterations.asList( rr );
			for ( Statement s : stmts ) {
				baseuri = s.getSubject();
			}
		}

		if ( null == baseuri ) {
			log.warn( "cannot update last modified date when no base uri is set" );
		}
		else {
			rc.remove( baseuri, MetadataConstants.DCT_MODIFIED, null );

			rc.add( new StatementImpl( baseuri, MetadataConstants.DCT_MODIFIED,
					vf.createLiteral( QueryExecutorAdapter.getCal( new Date() ) ) ) );
		}
	}
	catch ( RepositoryException e ) {
		log.warn( "could not update last modified date", e );
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:33,代码来源:AbstractSesameEngine.java

示例9: refreshHasValueRestrictions

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private void refreshHasValueRestrictions(final Map<Resource, URI> restrictions) throws QueryEvaluationException {
    hasValueByType.clear();
    hasValueByProperty.clear();
    final CloseableIteration<Statement, QueryEvaluationException> iter = RyaDAOHelper.query(ryaDAO, null, OWL.HASVALUE, null, conf);
    try {
        while (iter.hasNext()) {
            final Statement st = iter.next();
            final Resource restrictionClass = st.getSubject();
            if (restrictions.containsKey(restrictionClass)) {
                final URI property = restrictions.get(restrictionClass);
                final Value value = st.getObject();
                if (!hasValueByType.containsKey(restrictionClass)) {
                    hasValueByType.put(restrictionClass, new HashMap<>());
                }
                if (!hasValueByProperty.containsKey(property)) {
                    hasValueByProperty.put(property, new HashMap<>());
                }
                hasValueByType.get(restrictionClass).put(property, value);
                hasValueByProperty.get(property).put(restrictionClass, value);
            }
        }
    } finally {
        if (iter != null) {
            iter.close();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:28,代码来源:InferenceEngine.java

示例10: toValueArray

import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
 * Converts a statement to an array of its RDF values.
 * 
 * @param stmt - statement to be converted
 * @return array containing the RDF values comprised in the statement.
 */
public static Value[] toValueArray(Statement stmt) {

	Value[] out = new Value[stmt.getContext() == null ? 3 : 4];
	out[0] = stmt.getSubject();
	out[1] = stmt.getPredicate();
	out[2] = stmt.getObject();

	if (stmt.getContext() != null) {
		out[3] = stmt.getContext();
	}

	return out;
}
 
开发者ID:cumulusrdf,项目名称:cumulusrdf,代码行数:20,代码来源:Util.java

示例11: 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);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:17,代码来源:RyaDaoQueryWrapper.java

示例12: applyRuleRdfs9_1

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs9_1()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> ntIter = this.newThisIteration.match(null, RDFS.SUBCLASSOF, null);

	while (ntIter.hasNext()) {
		Statement nt = ntIter.next();

		Resource xxx = nt.getSubject();
		Value yyy = nt.getObject();

		if (yyy instanceof Resource) {
			CloseableIteration<? extends Statement, SailException> t1Iter;
			t1Iter = getWrappedConnection().getStatements(null, RDF.TYPE, xxx, true);

			while (t1Iter.hasNext()) {
				Statement t1 = t1Iter.next();

				Resource aaa = t1.getSubject();

				boolean added = addInferredStatement(aaa, RDF.TYPE, yyy);
				if (added) {
					nofInferred++;
				}
			}
			t1Iter.close();
		}
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:34,代码来源:ForwardChainingRDFSInferencerConnection.java

示例13: applyRuleN2b

import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
 * rrr rdfs:subPropertyOf  ppp 
 * rrr nrl:inverseProperty sss 
 * ppp nrl:inverseProperty qqq 
 * -->
 * sss rdfs:subPropertyOf  qqq
 * @return
 * @throws SailException
 */
private int applyRuleN2b()
throws SailException
{
	int nofInferred = 0;
	Iterator<Statement> it1 = this.newThisIteration.match(null, RDFS.SUBPROPERTYOF, null);
	while (it1.hasNext()) {
		Statement stmt1 = it1.next();
		Resource rrr = stmt1.getSubject();
		Value ppp = stmt1.getObject();
		if(ppp instanceof Resource) {
			CloseableIteration<? extends Statement, SailException> it2;
			it2 = getWrappedConnection().getStatements(rrr,NRL_InverseProperty, null, true);
			while (it2.hasNext()) {
				Statement stmt2 = it2.next();
				Value sss = stmt2.getObject();
				if(sss instanceof Resource) {
					CloseableIteration<? extends Statement, SailException> it3;
					it3 = getWrappedConnection().getStatements( (Resource) ppp,NRL_InverseProperty, null, true);
					while (it3.hasNext()) {
						Statement stmt3 = it3.next();
						Value qqq = stmt3.getObject();
						if( qqq instanceof Resource) {
							boolean added = addInferredStatement((Resource)sss, RDFS.SUBPROPERTYOF, qqq);
							if (added) {
								nofInferred++;
							}
						}
					}
					it3.close();
				}
			}
			it2.close();
		}
	}
	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:46,代码来源:ForwardChainingRDFSInferencerConnection.java

示例14: applyRuleRdfs7_1

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs7_1()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> ntIter = this.newThisIteration.match(null, null, null);

	while (ntIter.hasNext()) {
		Statement nt = ntIter.next();

		Resource xxx = nt.getSubject();
		URI aaa = nt.getPredicate();
		Value yyy = nt.getObject();

		CloseableIteration<? extends Statement, SailException> t1Iter;
		t1Iter = getWrappedConnection().getStatements(aaa, RDFS.SUBPROPERTYOF, null, true);

		while (t1Iter.hasNext()) {
			Statement t1 = t1Iter.next();

			Value bbb = t1.getObject();
			if (bbb instanceof URI) {
				boolean added = addInferredStatement(xxx, (URI)bbb, yyy);
				if (added) {
					nofInferred++;
				}
			}
		}
		t1Iter.close();
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:34,代码来源:ForwardChainingRDFSInferencerConnection.java

示例15: applyRuleRdfs2_2

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs2_2()
	throws SailException
{
	int nofInferred = 0;

	Iterator<Statement> ntIter = this.newThisIteration.match(null, RDFS.DOMAIN, null);

	while (ntIter.hasNext()) {
		Statement nt = ntIter.next();

		Resource aaa = nt.getSubject();
		Value zzz = nt.getObject();

		if (aaa instanceof URI && zzz instanceof Resource) {
			CloseableIteration<? extends Statement, SailException> t1Iter;
			t1Iter = getWrappedConnection().getStatements(null, (URI)aaa, null, true);

			while (t1Iter.hasNext()) {
				Statement t1 = t1Iter.next();

				Resource xxx = t1.getSubject();
				boolean added = addInferredStatement(xxx, RDF.TYPE, zzz);
				if (added) {
					nofInferred++;
				}
			}
			t1Iter.close();
		}
	}

	return nofInferred;
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:33,代码来源:ForwardChainingRDFSInferencerConnection.java


注:本文中的org.openrdf.model.Statement.getSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。