本文整理汇总了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();
}
示例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();
}
示例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() );
}