當前位置: 首頁>>代碼示例>>Java>>正文


Java RepositoryConnection.setNamespace方法代碼示例

本文整理匯總了Java中org.openrdf.repository.RepositoryConnection.setNamespace方法的典型用法代碼示例。如果您正苦於以下問題:Java RepositoryConnection.setNamespace方法的具體用法?Java RepositoryConnection.setNamespace怎麽用?Java RepositoryConnection.setNamespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.openrdf.repository.RepositoryConnection的用法示例。


在下文中一共展示了RepositoryConnection.setNamespace方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: finishLoading

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Override
protected void finishLoading( Properties props ) throws RepositoryException {
	String realname = ( null == getEngineName()
			? props.getProperty( Constants.ENGINE_NAME,
					FilenameUtils.getBaseName( props.getProperty( Constants.SMSS_LOCATION ) ) )
			: getEngineName() );
	MetadataQuery mq = new MetadataQuery( RDFS.LABEL );
	queryNoEx( mq );
	String str = mq.getString();
	if ( null != str ) {
		realname = str;
	}
	setEngineName( realname );

	RepositoryConnection rc = getRawConnection();
	rc.begin();
	for ( Map.Entry<String, String> en : Utility.DEFAULTNAMESPACES.entrySet() ) {
		rc.setNamespace( en.getKey(), en.getValue() );
	}
	rc.commit();
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:22,代碼來源:AbstractSesameEngine.java

示例2: initNamespaces

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
/**
 * Method to add the common namespaces into the namespace hash of our
 * RepositoryConnection. This function starts and commits a transaction.
 *
 * @param conn the connection to add the namespaces to
 *
 * @throws org.openrdf.repository.RepositoryException
 */
private static void initNamespaces( RepositoryConnection conn ) throws RepositoryException {

	conn.begin();
	for ( Map.Entry<String, String> e : Utility.DEFAULTNAMESPACES.entrySet() ) {
		conn.setNamespace( e.getKey(), e.getValue() );
	}
	conn.commit();
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:17,代碼來源:EngineLoader.java

示例3: testLoadCachesModern

import org.openrdf.repository.RepositoryConnection; //導入方法依賴的package包/類
@Test
public void testLoadCachesModern() throws Exception {
	engine.setBuilders( UriBuilder.getBuilder( BASEURI ), OWLB );
	engine.getRawConnection().add( engine.getBaseUri(), SEMTOOL.ReificationModel,
			SEMTOOL.SEMTOOL_Reification );

	RepositoryConnection rc = engine.getRawConnection();
	rc.begin();
	rc.setNamespace( "schema", OWLB.toString() );
	rc.setNamespace( "data", DATAURI.stringValue() );

	final URI DESC = OWLB.build( "Description" );
	rc.add( DESC, RDF.TYPE, OWL.DATATYPEPROPERTY );
	rc.add( DESC, RDFS.LABEL, new LiteralImpl( "508 Compliance" ) );

	final URI RELDESC = OWLB.build( "RelDesc" );
	rc.add( RELDESC, RDF.TYPE, OWL.DATATYPEPROPERTY );
	rc.add( RELDESC, RDFS.LABEL, new LiteralImpl( "Zippalee!" ) );

	final URI conceptclass = OWLB.build( "myconceptclass1" );
	rc.add( conceptclass, RDF.TYPE, RDFS.CLASS );
	rc.add( conceptclass, RDFS.SUBCLASSOF, OWLB.getConceptUri().build() );
	rc.add( conceptclass, RDFS.LABEL, new LiteralImpl( "My Concept Class 1" ) );

	final URI conceptclass2 = OWLB.build( "myconceptclass2" );
	rc.add( conceptclass2, RDF.TYPE, RDFS.CLASS );
	rc.add( conceptclass2, RDFS.SUBCLASSOF, OWLB.getConceptUri().build() );
	rc.add( conceptclass2, RDFS.LABEL, new LiteralImpl( "My Concept Class 2" ) );

	final URI concept = DATAB.build( "myconcept1" );
	rc.add( concept, RDF.TYPE, RDFS.CLASS );
	rc.add( concept, RDFS.SUBCLASSOF, conceptclass );
	rc.add( concept, RDFS.LABEL, new LiteralImpl( "My Concept" ) );
	rc.add( concept, DESC, new LiteralImpl( "508 Compliant?" ) );

	final URI concept2 = DATAB.build( "myconcept2" );
	rc.add( concept2, RDF.TYPE, RDFS.CLASS );
	rc.add( concept2, RDFS.SUBCLASSOF, conceptclass2 );
	rc.add( concept2, RDFS.LABEL, new LiteralImpl( "My Other Concept" ) );
	rc.add( concept2, DESC, new LiteralImpl( "feliz cumpleaños" ) );

	final URI relclass = OWLB.build( "relationclass" );
	rc.add( relclass, RDF.TYPE, OWL.OBJECTPROPERTY );
	rc.add( relclass, RDFS.SUBPROPERTYOF, OWLB.getRelationUri().build() );
	rc.add( relclass, RDFS.LABEL, new LiteralImpl( "A Relation Class" ) );

	final URI rel = DATAB.build( "myrel" );
	rc.add( rel, RDFS.SUBPROPERTYOF, relclass );
	rc.add( rel, RDFS.LABEL, new LiteralImpl( "My Relation" ) );
	rc.add( rel, RELDESC, new LiteralImpl( "A Relation Prop" ) );
	rc.add( concept, rel, concept2 );

	rc.commit();

	el.loadCaches( engine );

	assertFalse( el.hasCachedPropertyClass( "Description" ) );
	assertTrue( el.hasCachedPropertyClass( "508 Compliance" ) );
	assertTrue( el.hasCachedPropertyClass( "Zippalee!" ) );

	assertEquals( 2, el.getCache( CacheType.CONCEPTCLASS ).size() );
	assertEquals( 2, el.getCache( CacheType.PROPERTYCLASS ).size() );
	assertEquals( 1, el.getCache( CacheType.RELATIONCLASS ).size() );
}
 
開發者ID:Ostrich-Emulators,項目名稱:semtool,代碼行數:65,代碼來源:QaCheckerTest.java


注:本文中的org.openrdf.repository.RepositoryConnection.setNamespace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。