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


Java Statement.getObject方法代码示例

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


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

示例1: 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 ) );
		}
	};
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:24,代码来源:LegacyUpgrader.java

示例2: 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;
	}
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:26,代码来源:InstancePropertyTableModel.java

示例3: 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

示例4: 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();
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:22,代码来源:StructurednessAnalyzer.java

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

示例6: storeStatements

import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Override
public void storeStatements(final Collection<RyaStatement> ryaStatements) throws IOException {
    // create a feature collection
    final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
    for (final RyaStatement ryaStatement : ryaStatements) {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // if the predicate list is empty, accept all predicates.
        // Otherwise, make sure the predicate is on the "valid" list
        final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate());

        if (isValidPredicate && (statement.getObject() instanceof Literal)) {
            try {
                final SimpleFeature feature = createFeature(featureType, statement);
                featureCollection.add(feature);
            } catch (final ParseException e) {
                logger.warn("Error getting geo from statement: " + statement.toString(), e);
            }
        }
    }

    // write this feature collection to the store
    if (!featureCollection.isEmpty()) {
        featureStore.addFeatures(featureCollection);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:26,代码来源:GeoWaveGeoIndexer.java

示例7: 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 );
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:29,代码来源:InsightManagerImpl.java

示例8: 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

示例9: map

import org.openrdf.model.Statement; //导入方法依赖的package包/类
@Override
public Value[] map(final Statement statement) throws RDFHandlerException {
    if (match(statement.getSubject())) {
        return new Value[] { statement.getSubject() };
    } else if (match(statement.getContext())) {
        return new Value[] { statement.getContext() };
    } else if (match(statement.getObject())) {
        return new Value[] { statement.getObject() };
    } else if (match(statement.getPredicate())) {
        return new Value[] { statement.getPredicate() };
    } else {
        return new Value[] { eu.fbk.rdfpro.Mapper.BYPASS_KEY };
    }
}
 
开发者ID:dkmfbk,项目名称:pikes,代码行数:15,代码来源:ProcessorASNorm.java

示例10: applyRuleRdfs11_1

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private int applyRuleRdfs11_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((Resource)yyy, RDFS.SUBCLASSOF, null, true);

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

				Value zzz = t1.getObject();

				if (zzz instanceof Resource) {
					boolean added = addInferredStatement(xxx, RDFS.SUBCLASSOF, zzz);
					if (added) {
						nofInferred++;
					}
				}
			}
			t1Iter.close();
		}
	}

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

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

示例12: getObjectLiteral

import org.openrdf.model.Statement; //导入方法依赖的package包/类
/**
 * Returns the literal value of the triple's object matching the predicate.
 * 
 * @param model the model of the configuration settings.
 * @param implNode the model representing a configuration setting.
 * @param predicate the predicate defining a configuration attribute.
 * @return the literal value of the object or null.
 * @throws SailConfigException if there is no literal to return.
 */
protected Literal getObjectLiteral(Graph model, Resource implNode, URI property) throws SailConfigException {
	Iterator<Statement> objects = model.match(implNode, property, null);
	if (!objects.hasNext())
		return null;
	Statement st = objects.next();
	if (objects.hasNext())
		throw new SailConfigException("found multiple object values for " + property);
	Value object = st.getObject();
	if (object instanceof Literal)
		return (Literal) object;
	else
		throw new SailConfigException("object value is not a Literal: " + property + " " + object); 
}
 
开发者ID:goerlitz,项目名称:rdffederator,代码行数:23,代码来源:AbstractSailConfig.java

示例13: applyRuleRdfs3_2

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

	Iterator<Statement> ntIter = this.newThisIteration.match(null, RDFS.RANGE, 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();

				Value uuu = t1.getObject();
				if (uuu instanceof Resource) {
					boolean added = addInferredStatement((Resource)uuu, RDF.TYPE, zzz);
					if (added) {
						nofInferred++;
					}
				}
			}
			t1Iter.close();
		}
	}

	return nofInferred;

}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:36,代码来源: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: deleteStatements

import org.openrdf.model.Statement; //导入方法依赖的package包/类
private void deleteStatements(final Collection<RyaStatement> ryaStatements) throws IOException {
    // create a feature collection
    final DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();

    for (final RyaStatement ryaStatement : ryaStatements) {
        final Statement statement = RyaToRdfConversions.convertStatement(ryaStatement);
        // if the predicate list is empty, accept all predicates.
        // Otherwise, make sure the predicate is on the "valid" list
        final boolean isValidPredicate = validPredicates.isEmpty() || validPredicates.contains(statement.getPredicate());

        if (isValidPredicate && (statement.getObject() instanceof Literal)) {
            try {
                final SimpleFeature feature = createFeature(featureType, statement);
                featureCollection.add(feature);
            } catch (final ParseException e) {
                logger.warn("Error getting geo from statement: " + statement.toString(), e);
            }
        }
    }

    // remove this feature collection from the store
    if (!featureCollection.isEmpty()) {
        final Set<Identifier> featureIds = new HashSet<Identifier>();
        final FilterFactory filterFactory = CommonFactoryFinder.getFilterFactory(null);
        final Set<String> stringIds = DataUtilities.fidSet(featureCollection);
        for (final String id : stringIds) {
            featureIds.add(filterFactory.featureId(id));
        }
        final Filter filter = filterFactory.id(featureIds);
        featureStore.removeFeatures(filter);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:33,代码来源:GeoMesaGeoIndexer.java


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