本文整理汇总了Java中org.openrdf.model.vocabulary.RDFS类的典型用法代码示例。如果您正苦于以下问题:Java RDFS类的具体用法?Java RDFS怎么用?Java RDFS使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RDFS类属于org.openrdf.model.vocabulary包,在下文中一共展示了RDFS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getDbInfo
import org.openrdf.model.vocabulary.RDFS; //导入依赖的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: getId
import org.openrdf.model.vocabulary.RDFS; //导入依赖的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;
}
示例3: getMetadata
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
private Map<URI, String> getMetadata( CommandLine cmd ) {
Map<URI, String> map = new HashMap<>();
Map<String, URI> mets = new HashMap<>();
mets.put( "organization", DCTERMS.CREATOR );
mets.put( "poc", DCTERMS.PUBLISHER );
mets.put( "summary", DCTERMS.DESCRIPTION );
mets.put( "title", RDFS.LABEL );
for ( Map.Entry<String, URI> en : mets.entrySet() ) {
if ( cmd.hasOption( en.getKey() ) ) {
String rawval = cmd.getOptionValue( en.getKey() );
map.put( en.getValue(), rawval );
}
}
return map;
}
示例4: finishLoading
import org.openrdf.model.vocabulary.RDFS; //导入依赖的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();
}
示例5: getPerspectiveStatements
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
protected static Model getPerspectiveStatements( Perspective p,
ValueFactory vf, UriBuilder urib, User user ) {
Model statements = new LinkedHashModel();
URI pid = p.getId();
Date now = new Date();
statements.add( new StatementImpl( pid, RDF.TYPE, SEMPERS.Perspective ) );
statements.add( new StatementImpl( pid, RDFS.LABEL,
vf.createLiteral( p.getLabel() ) ) );
if ( null != p.getDescription() ) {
statements.add( new StatementImpl( pid, DCTERMS.DESCRIPTION,
vf.createLiteral( p.getDescription() ) ) );
}
statements.add( new StatementImpl( pid, DCTERMS.CREATED,
vf.createLiteral( now ) ) );
statements.add( new StatementImpl( pid, DCTERMS.MODIFIED,
vf.createLiteral( now ) ) );
statements.add( new StatementImpl( pid, DCTERMS.CREATOR,
vf.createLiteral( getAuthorInfo( user ) ) ) );
return statements;
}
示例6: getParameterStatements
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
protected static Model getParameterStatements( Parameter parameter,
URI predicateUri, URI queryUri, ValueFactory vf, UriBuilder urib,
User user ) {
Model statements = new LinkedHashModel();
URI pid = parameter.getId();
statements.add( new StatementImpl( pid, RDFS.LABEL,
vf.createLiteral( parameter.getLabel() ) ) );
statements.add( new StatementImpl( pid, SPL.predicate, predicateUri ) );
statements.add( new StatementImpl( pid, SP.query, queryUri ) );
statements.add( new StatementImpl( predicateUri, RDFS.LABEL,
vf.createLiteral( parameter.getLabel() ) ) );
statements.add( new StatementImpl( queryUri, SP.text,
vf.createLiteral( parameter.getDefaultQuery() ) ) );
return statements;
}
示例7: testExec3
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testExec3() throws Exception {
InMemorySesameEngine eng = InMemorySesameEngine.open();
StatementAddingExecutor sae = new StatementAddingExecutor(
Arrays.asList( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "label" ) ) ), true );
sae.resetStatements( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "tester" ) ) );
Model before = eng.toModel();
eng.execute( sae );
Model after = eng.toModel();
eng.closeDB();
assertTrue( ( before.size() + 1 ) == after.size() );
assertTrue( after.contains( RDFS.DOMAIN, RDFS.LABEL, new LiteralImpl( "tester" ) ) );
assertFalse( after.contains( RDFS.DOMAIN, RDFS.LABEL, new LiteralImpl( "label" ) ) );
}
示例8: setUp
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
Repository fromrepo = new SailRepository( new MemoryStore() );
Repository torepo = new SailRepository( new MemoryStore() );
fromrepo.initialize();
torepo.initialize();
from = fromrepo.getConnection();
to = torepo.getConnection();
from.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "test" ) ) );
from.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "test2" ) ) );
from.setNamespace( OWL.PREFIX, OWL.NAMESPACE );
}
示例9: testClear
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testClear() throws Exception {
StatementAddingExecutor sae = new StatementAddingExecutor();
sae.addStatement( new StatementImpl( RDFS.DATATYPE, RDFS.LABEL,
new LiteralImpl( "test label" ) ) );
eng.execute( sae );
ListQueryAdapter<URI> q
= OneVarListQueryAdapter.getUriList( "SELECT ?s WHERE { ?s rdfs:label ?o }" );
List<URI> addeduris = new ArrayList<>( eng.queryNoEx( q ) );
q.clear();
EngineUtil2.clear( eng );
List<URI> newuris = eng.queryNoEx( q );
assertNotEquals( addeduris, newuris );
assertTrue( newuris.isEmpty() );
}
示例10: testGetInstancesNoPropsAvailable
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testGetInstancesNoPropsAvailable() throws Exception {
// this is just extra stuff that shouldn't be returned in the tests
final URI REL = OWLB.getRelationUri().build();
final URI EXTRA = OWLB.build( "AnotherRelType" );
final URI EXTRAIMPL = DATAB.build( "AnotherRel" );
final URI ALAN = DATAB.build( "Alan" );
final URI CADILLAC = DATAB.build( "Cadillac" );
engine.getRawConnection().add( EXTRA, RDFS.SUBPROPERTYOF, REL );
engine.getRawConnection().add( EXTRAIMPL, RDF.TYPE, REL );
Model expected = new LinkedHashModel();
expected.add( YURI, YPY, YUGO );
expected.add( ALAN, PURCHASE, CADILLAC );
Model model = NodeDerivationTools.getInstances( HUMAN, PURCHASE, CAR,
null, engine );
assertEquals( expected, model );
}
示例11: compareData
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
private void compareData( RepositoryConnection testRc, Model expected,
UriBuilder owl, UriBuilder base ) throws Exception {
List<Statement> stmts
= Iterations.asList( testRc.getStatements( null, null, null, false ) );
Model test = new LinkedHashModel( stmts );
assertEquals( "dataset size", expected.size(), test.size() );
compare( "category concept", expected, test, null, RDF.TYPE,
owl.getConceptUri( "Category" ) );
compare( "beverages concept", expected, test,
base.getConceptUri().add( "Category" ).add( "Beverages" ).build(),
null, null );
compare( "dairy products", expected, test,
null, RDFS.LABEL, new LiteralImpl( "Dairy Products" ) );
compare( "chai-beverages link", expected, test,
null, RDFS.LABEL, new LiteralImpl( "Chai Category Beverages" ) );
URI bev
= base.getRelationUri().add( "Category" ).add( "Chai_x_Beverages" ).build();
compare( "chai-beverages category", expected, test,
bev, RDFS.SUBPROPERTYOF, owl.getRelationUri( "Category" ) );
}
示例12: testModifyData
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testModifyData() throws Exception {
instance.execute( new ModificationExecutorAdapter( true ) {
@Override
public void exec( RepositoryConnection conn ) throws RepositoryException {
conn.add( new URIImpl( "http://foo.bar/testuri" ), RDFS.LABEL,
new LiteralImpl( "extra" ) );
}
} );
OneVarListQueryAdapter<String> lqa
= OneVarListQueryAdapter.getStringList( "SELECT ?label { ?s rdfs:label ?label }" );
Set<String> names = new HashSet<>( instance.query( lqa ) );
Set<String> expected = new HashSet<>( Arrays.asList( "Reification", "RDR Reification",
"Alan", "First Name", "Purchased", "Reification Model", "Date", "Yugo",
"Cadillac", "Price", "Car", "Database", "Yuri", "OS-EM Semantic Toolkit Reification",
"Has", "Last Name", "W3C Reification", "Human Being", "Data View", "extra" ) );
instance.closeDB();
assertEquals( expected, names );
}
示例13: setUp
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
eng = InMemorySesameEngine.open();
RepositoryConnection rc = eng.getRawConnection();
rc.begin();
rc.add( DATA, null, RDFFormat.NTRIPLES );
rc.add( new StatementImpl( RDFS.DOMAIN, RDFS.LABEL,
new LiteralImpl( "label" ) ) );
rc.remove( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED, null );
rc.add( eng.getBaseUri(), MetadataConstants.DCT_MODIFIED,
rc.getValueFactory().createLiteral( new Date() ) );
rc.commit();
}
示例14: testGetLabels
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testGetLabels() throws Exception {
InMemorySesameEngine eng = InMemorySesameEngine.open();
eng.getRawConnection().begin();
eng.getRawConnection().add( new StatementImpl( RDFS.ISDEFINEDBY,
RDFS.LABEL, new LiteralImpl( "my label" ) ) );
eng.getRawConnection().add( new StatementImpl( RDFS.MEMBER,
RDFS.LABEL, new LiteralImpl( "my label 2" ) ) );
eng.getRawConnection().commit();
String label = Utility.getInstanceLabel( RDFS.ISDEFINEDBY, eng );
assertEquals( "my label", label );
Map<Resource, String> labels = Utility.getInstanceLabels( null, eng );
assertTrue( labels.isEmpty() );
labels = Utility.getInstanceLabels( Arrays.asList(
RDFS.MEMBER, RDFS.DOMAIN ), eng );
assertEquals( "domain", labels.get( RDFS.DOMAIN ) );
assertEquals( "my label 2", labels.get( RDFS.MEMBER ) );
labels = Utility.getInstanceLabels( Arrays.asList( RDFS.ISDEFINEDBY,
RDFS.LITERAL ), null );
assertEquals( 2, labels.size() );
}
示例15: testHasProp2
import org.openrdf.model.vocabulary.RDFS; //导入依赖的package包/类
@Test
public void testHasProp2() {
LoadingSheetData lsd = LoadingSheetData.nodesheet( "sbj" );
lsd.addProperties( Arrays.asList( "xx:label", "yy", "yy:junk" ) );
Map<String, Value> props = new HashMap<>();
ValueFactory vf = new ValueFactoryImpl();
props.put( "xx:label", vf.createLiteral( "my label" ) );
props.put( "yy", vf.createLiteral( "my y val" ) );
props.put( "yy:junk", vf.createLiteral( "my junk val" ) );
LoadingNodeAndPropertyValues nap = lsd.add( "instance", "object", props );
Map<String, String> nsmap = new HashMap<>();
nsmap.put( RDFS.PREFIX, RDFS.NAMESPACE );
nsmap.put( "xx", "http://google.com/" );
assertFalse( nap.hasProperty( RDFS.LABEL, nsmap ) );
}