本文整理匯總了Java中org.openrdf.model.impl.URIImpl類的典型用法代碼示例。如果您正苦於以下問題:Java URIImpl類的具體用法?Java URIImpl怎麽用?Java URIImpl使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
URIImpl類屬於org.openrdf.model.impl包,在下文中一共展示了URIImpl類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getAccess
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
private DbAccess getAccess( DbInfo dbi, SemossUser user, boolean forInsightsDb ) {
Map<org.openrdf.model.URI, DbAccess> accesses = usermapper.getAccesses( user );
org.openrdf.model.URI insuri = new URIImpl( dbi.getInsightsUrl() );
org.openrdf.model.URI dburi = new URIImpl( dbi.getDataUrl() );
if ( forInsightsDb ) {
if ( accesses.containsKey( insuri ) ) {
return accesses.get( insuri );
}
// if we don't have specific access to the insights db, we must have
// read access on it if we can read the database itself
return ( accesses.containsKey( dburi ) ? DbAccess.READ : DbAccess.NONE );
}
return accesses.getOrDefault( dburi, DbAccess.NONE );
}
示例2: openDB
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
/**
* Opens the database. This function calls (in this order)
* <ol>
* <li>{@link #startLoading(java.util.Properties) },
* <li>{@link #setUris(java.lang.String, java.lang.String) },
* <li>{@link #finishLoading(java.util.Properties) }
* </ol>
*
* @param initprops
*/
@Override
public void openDB( Properties initprops ) throws RepositoryException {
prop = Utility.copyProperties( initprops );
if ( log.isDebugEnabled() ) {
StringBuilder sb = new StringBuilder( "db properties:" );
final String lf = System.getProperty( "line.separator" );
for ( String key : initprops.stringPropertyNames() ) {
sb.append( lf ).append( key ).append( "=>" ).append( initprops.getProperty( key ) );
}
log.debug( sb.toString() );
}
startLoading( prop );
String baseuristr = prop.getProperty( Constants.BASEURI_KEY, "" );
String owlstarter = prop.getProperty( Constants.SEMOSS_URI, null );
if ( null == owlstarter ) {
log.warn( "no schema URI set...using " + SEMONTO.NAMESPACE );
owlstarter = SEMONTO.NAMESPACE;
}
baseuri = new URIImpl( setUris( baseuristr, owlstarter ).stringValue() );
finishLoading( prop );
}
示例3: getMetadata
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Override
public ImportMetadata getMetadata( File file ) throws IOException, ImportValidationException {
logger.debug( "getting metadata from file: " + file );
LowMemXlsReader reader = null;
try {
reader = new LowMemXlsReader( file );
ImportMetadata data = reader.getMetadata();
data.setSourceOfData( new URIImpl( file.toURI().toString() ) );
return data;
}
finally {
if ( null != reader ) {
reader.release();
}
}
}
示例4: readOneFile
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Override
public ImportData readOneFile( File file ) throws IOException, ImportValidationException {
logger.debug( "loading data from file: " + file );
LowMemXlsReader rdr = null;
try {
rdr = new LowMemXlsReader( file );
rdr.keepSheetDataInMemory( keepLoadInMemory );
ImportData d = rdr.getData();
d.getMetadata().setSourceOfData( new URIImpl( file.toURI().toString() ) );
logger.debug( "finished reading file: " + file );
return d;
}
finally {
if ( null != rdr ) {
rdr.release();
}
}
}
示例5: readOneFile
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Override
public ImportData readOneFile( File file ) throws IOException, ImportValidationException {
ImportData data = new ImportData();
ImportMetadata im = data.getMetadata();
im.setSourceOfData( new URIImpl( file.toURI().toString() ) );
im.setLegacyMode( true );
try ( Reader rdr = new BufferedReader( new FileReader( file ) ) ) {
mapReader = new CsvMapReader( rdr, CsvPreference.STANDARD_PREFERENCE );
File propfile = propCSVFile( mapReader );
setRdfMapFromFile( propfile ); // will throw an IOException if missing file
createProcessors();
processConceptRelationURIs( data );
processNodePropURIs( data );
processRelationships( data );
}
finally {
if ( null != mapReader ) {
mapReader.close();
}
}
return data;
}
示例6: createNew
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Test
public void createNew() throws IOException, EngineManagementException {
File topdir = File.createTempFile( "eutest-", "" );
topdir.delete();
topdir.mkdirs();
File smss = null;
try {
EngineCreateBuilder ecb = new EngineCreateBuilder( topdir, "testdb" )
.setDefaultBaseUri( new URIImpl( "http://va.gov/ontologies" ), true )
.setReificationModel( ReificationStyle.LEGACY )
.setFiles( Arrays.asList( LEGACY ) )
.setBooleans( true, true, true );
smss = EngineUtil2.createNew( ecb, null );
assertTrue( smss.exists() );
}
finally {
FileUtils.deleteQuietly( topdir );
FileUtils.deleteQuietly( smss );
}
}
示例7: createNew2
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Test
public void createNew2() throws IOException, EngineManagementException {
File topdir = File.createTempFile( "eutest-", "" );
topdir.delete();
topdir.mkdirs();
File smss = null;
try {
EngineCreateBuilder ecb = new EngineCreateBuilder( topdir, "testdb" )
.setDefaultBaseUri( new URIImpl( "http://va.gov/ontologies" ), true )
.setReificationModel( ReificationStyle.LEGACY )
.setInsightsFile( new File( "src/test/resources/insmgr.data-source.ttl" ) )
.setFiles( Arrays.asList( LEGACY ) )
.addVocabulary( new File( "src/main/resources/models/semtool.ttl" ).toURI().toURL() )
.setBooleans( true, true, true );
smss = EngineUtil2.createNew( ecb, null );
assertTrue( smss.exists() );
}
finally {
FileUtils.deleteQuietly( topdir );
FileUtils.deleteQuietly( smss );
}
}
示例8: createNew3
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Test
public void createNew3() throws IOException, EngineManagementException {
File topdir = File.createTempFile( "eutest-", "" );
topdir.delete();
topdir.mkdirs();
File smss = null;
try {
EngineCreateBuilder ecb = new EngineCreateBuilder( topdir, "testdb" )
.setDefaultBaseUri( new URIImpl( "http://va.gov/ontologies" ), true )
.setReificationModel( ReificationStyle.LEGACY )
.setInsightsFile( new File( "src/test/resources/insmgr.data-source.ttl" ) )
.setFiles( Arrays.asList( LEGACY ) )
.addVocabulary( new File( "src/main/resources/models/semtool.ttlx" ).toURI().toURL() )
.setBooleans( true, true, true );
smss = EngineUtil2.createNew( ecb, null );
assertTrue( smss.exists() );
}
finally {
FileUtils.deleteQuietly( topdir );
FileUtils.deleteQuietly( smss );
}
}
示例9: createNew4
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Test
public void createNew4() throws IOException, EngineManagementException {
File topdir = File.createTempFile( "eutest-", "" );
topdir.delete();
topdir.mkdirs();
File smss = null;
try {
EngineCreateBuilder ecb = new EngineCreateBuilder( topdir, "testdb" )
.setDefaultBaseUri( new URIImpl( "http://va.gov/ontologies" ), true )
.setReificationModel( ReificationStyle.LEGACY )
.setInsightsFile( new File( "src/test/resources/insmgr.data-source.ttl" ) )
.setFiles( Arrays.asList( LEGACY ) )
.addVocabulary( new File( "src/main/resources/models/semtool.ttl" ).toURI().toURL() )
.setBooleans( true, true, true )
.setEngineImpl( BigDataEngine.class );
smss = EngineUtil2.createNew( ecb, null );
assertTrue( smss.exists() );
}
finally {
FileUtils.deleteQuietly( topdir );
FileUtils.deleteQuietly( smss );
}
}
示例10: testModifyData
import org.openrdf.model.impl.URIImpl; //導入依賴的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 );
}
示例11: search
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
public void search( Query q, Set<SEMOSSVertex> nodes, Set<SEMOSSEdge> edges ) {
try {
TopDocs hits = searcher.search( q, 500 );
for ( ScoreDoc sd : hits.scoreDocs ) {
Document doc = searcher.doc( sd.doc );
URI uri = new URIImpl( doc.get( URI_FIELD ) );
if ( vertStore.containsKey( uri ) ) {
GraphElement v = vertStore.get( uri );
if ( v.isNode() ) {
nodes.add( SEMOSSVertex.class.cast( v ) );
}
else {
edges.add( SEMOSSEdge.class.cast( v ) );
}
}
}
}
catch ( IOException e ) {
log.error( e, e );
}
}
示例12: GraphicalQueryPanel
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
/**
* Creates new form GraphicalQueryBuilderPanel
*
* @param progressname the progress bar name to update
* @param csfac the graph color shape factory to use
*/
public GraphicalQueryPanel( String progressname, GraphColorShapeRepository csfac ) {
progress = progressname;
this.csfac = csfac;
initComponents();
initVizualizer();
visarea.add( new GraphZoomScrollPane( view ) );
addConceptNodeAction = new AbstractAction() {
private static final long serialVersionUID = -2138227128423655724L;
@Override
public void actionPerformed( ActionEvent e ) {
URI concept = new URIImpl( e.getActionCommand() );
vfac.setType( concept );
}
};
addGraphListener();
}
示例13: fillSubjectList
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
public static ArrayList<Resource> fillSubjectList(String param) throws IOException {
ArrayList<Resource> retList = new ArrayList<Resource>();
File f = new File(param);
if (f.exists() && f.isFile()) {
//read in
LineReader lR = new LineReader(f);
while (!lR.isEmpty()) {
retList.add(new URIImpl(lR.readLine()));
}
lR.close();
} else if (param.equals(WILDCARD)) {
//use empty list
} else {
retList.add(new URIImpl(param));
}
return retList;
}
示例14: toString_URIs_noVisi
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Test
public void toString_URIs_noVisi() throws BindingSetConversionException {
// Setup the binding set that will be converted.
final MapBindingSet originalBindingSet = new MapBindingSet();
originalBindingSet.addBinding("x", new URIImpl("http://a"));
originalBindingSet.addBinding("y", new URIImpl("http://b"));
originalBindingSet.addBinding("z", new URIImpl("http://c"));
final VisibilityBindingSet visiSet = new VisibilityBindingSet(originalBindingSet);
// Convert it to a String.
final VariableOrder varOrder = new VariableOrder("y", "z", "x");
final VisibilityBindingSetStringConverter converter = new VisibilityBindingSetStringConverter();
final String bindingSetString = converter.convert(visiSet, varOrder);
// Ensure it converted to the expected result.l
final String expected =
"http://b<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
"http://c<<~>>http://www.w3.org/2001/XMLSchema#anyURI:::" +
"http://a<<~>>http://www.w3.org/2001/XMLSchema#anyURI";
assertEquals(expected, bindingSetString);
}
示例15: setUp
import org.openrdf.model.impl.URIImpl; //導入依賴的package包/類
@Before
public void setUp() throws Exception {
Anno4j anno4j = new Anno4j();
clazz = anno4j.createObject(BuildableRDFSClazz.class);
clazz.addLabel("MyClazz");
BuildableRDFSProperty foo = anno4j.createObject(BuildableRDFSProperty.class, (Resource) new URIImpl("http://example.org/#foo"));
foo.setLabels(Sets.<CharSequence>newHashSet("foo"));
foo.setDomains(Sets.<RDFSClazz>newHashSet(clazz));
foo.setRanges(Sets.<RDFSClazz>newHashSet(clazz));
generationConfig = new OntGenerationConfig();
List<String> identifierLangPreference = Collections.singletonList(OntGenerationConfig.UNTYPED_LITERAL);
List<String> javaDocLangPreference = Collections.singletonList(OntGenerationConfig.UNTYPED_LITERAL);
generationConfig.setIdentifierLanguagePreference(identifierLangPreference);
generationConfig.setJavaDocLanguagePreference(javaDocLangPreference);
}