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


Java Namespace类代码示例

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


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

示例1: testGetNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
public void testGetNamespaces() throws Exception {
    String namespace = "urn:testNamespace#";
    String prefix = "pfx";
    connection.setNamespace(prefix, namespace);

    namespace = "urn:testNamespace2#";
    prefix = "pfx2";
    connection.setNamespace(prefix, namespace);

    RepositoryResult<Namespace> result = connection.getNamespaces();
    int count = 0;
    while (result.hasNext()) {
        result.next();
        count++;
    }

    assertEquals(2, count);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:19,代码来源:RdfCloudTripleStoreTest.java

示例2: getNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public Map<String,String> getNamespaces() {
	assertModel();
	Map<String,String> nsMap = new HashMap<String,String>();
	try {
		RepositoryResult<Namespace> openrdfMap = this.connection.getNamespaces();
		openrdfMap.enableDuplicateFilter();
		List<Namespace> openrdfList =  Iterations.asList(openrdfMap);
		for(Namespace openrdfNamespace : openrdfList) {
			nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace.getName());
		}
		return nsMap;
	} catch(RepositoryException e) {
		throw new ModelRuntimeException(e);
	}
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:17,代码来源:RepositoryModel.java

示例3: getNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public Map<String,String> getNamespaces() {
	this.assertModel();
	Map<String,String> nsMap = new HashMap<String,String>();
	try {
		RepositoryResult<Namespace> openrdfMap = this.connection.getNamespaces();
		openrdfMap.enableDuplicateFilter();
		while (openrdfMap.hasNext()) {
			Namespace openrdfNamespace = openrdfMap.next();
			nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace.getName());
		}
		return nsMap;
	} catch(RepositoryException e) {
		throw new ModelRuntimeException(e);
	}
}
 
开发者ID:semweb4j,项目名称:semweb4j,代码行数:17,代码来源:RepositoryModelSet.java

示例4: getNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public CloseableIteration<? extends Namespace, SailException> getNamespaces()
		throws SailException {

	return new CloseableIteratorIteration<Namespace, SailException>() {
		private Iterator<Namespace> namespaces = Arrays.asList(
				new Namespace[] {
						new NamespaceImpl(OWL.PREFIX, OWL.NAMESPACE)
						//TODO list all supported namespaces from the file 
						})
				.iterator();

		@Override
		public boolean hasNext() throws SailException {
			return namespaces.hasNext();
		}

		@Override
		public Namespace next() throws SailException {
			return namespaces.next();
		};
	};
}
 
开发者ID:JervenBolleman,项目名称:sparql-identifiers,代码行数:24,代码来源:IdentifiersOrgConnection.java

示例5: getNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public CloseableIteration<? extends Namespace, SailException> getNamespaces()
		throws SailException {

	return new CloseableIteratorIteration<Namespace, SailException>() {
		private Iterator<Namespace> namespaces = Arrays.asList(
				new Namespace[] {
						new SimpleNamespace(FALDO.PREFIX, FALDO.NAMESPACE),
						new SimpleNamespace(BED.PREFIX, BED.NAMESPACE) })
				.iterator();

		@Override
		public boolean hasNext() throws SailException {
			return namespaces.hasNext();
		}

		@Override
		public Namespace next() throws SailException {
			return namespaces.next();
		};
	};
}
 
开发者ID:JervenBolleman,项目名称:sparql-bed,代码行数:23,代码来源:BEDConnection.java

示例6: getNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public Map<String, String> getNamespaces() {
	Map<String, String> ret = new HashMap<>();
	try {
		RepositoryConnection rc = getRawConnection();

		for ( Namespace ns : Iterations.asList( rc.getNamespaces() ) ) {
			ret.put( ns.getPrefix(), ns.getName() );
		}
	}
	catch ( RepositoryException re ) {
		log.warn( "could not retrieve namespaces", re );
	}
	return ret;
}
 
开发者ID:Ostrich-Emulators,项目名称:semtool,代码行数:16,代码来源:AbstractSesameEngine.java

示例7: iterateNamespace

import org.openrdf.model.Namespace; //导入依赖的package包/类
public CloseableIteration<? extends Namespace, SailException> iterateNamespace() {
    try {
        //for this one we will go directly to the store
        final CloseableIteration<? extends Namespace, RdfDAOException> iteration = namespaceManager.iterateNamespace();
        return new CloseableIteration<Namespace, SailException>() {
            @Override
            public void close() throws SailException {
                iteration.close();
            }

            @Override
            public boolean hasNext() throws SailException {
                return iteration.hasNext();
            }

            @Override
            public Namespace next() throws SailException {
                return iteration.next();
            }

            @Override
            public void remove() throws SailException {
                iteration.remove();
            }
        };
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:30,代码来源:NamespaceManager.java

示例8: iterateNamespace

import org.openrdf.model.Namespace; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Override
public CloseableIteration<Namespace, RyaDAOException> iterateNamespace() throws RyaDAOException {
    try {
        final Scanner scanner = connector.createScanner(tableLayoutStrategy.getNs(),
                ALL_AUTHORIZATIONS);
        scanner.fetchColumnFamily(INFO_NAMESPACE_TXT);
        final Iterator<Map.Entry<Key, Value>> result = scanner.iterator();
        return new AccumuloNamespaceTableIterator(result);
    } catch (final Exception e) {
        throw new RyaDAOException(e);
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:14,代码来源:AccumuloRyaDAO.java

示例9: next

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public Namespace next() throws RdfDAOException {
    if (hasNext()) {
        return getNamespace(result);
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:8,代码来源:AccumuloNamespaceTableIterator.java

示例10: getNamespace

import org.openrdf.model.Namespace; //导入依赖的package包/类
public static Namespace getNamespace(final Iterator<Entry<Key, Value>> rowResults) {
    for (; rowResults.hasNext(); ) {
        final Entry<Key, Value> next = rowResults.next();
        final Key key = next.getKey();
        final Value val = next.getValue();
        final String cf = key.getColumnFamily().toString();
        final String cq = key.getColumnQualifier().toString();
        return new NamespaceImpl(key.getRow().toString(),
                new String(val.get(), StandardCharsets.UTF_8));
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:13,代码来源:AccumuloNamespaceTableIterator.java

示例11: compareTo

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public int compareTo(final Namespace o) {
    if (!namespace.equalsIgnoreCase(o.getName())) {
        return namespace.compareTo(o.getName());
    }
    if (!prefix.equalsIgnoreCase(o.getPrefix())) {
        return prefix.compareTo(o.getPrefix());
    }
    return 0;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:SimpleMongoDBNamespaceManager.java

示例12: next

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public Namespace next() throws RyaDAOException {
    final DBObject ns = cursor.next();
    final Map values = ns.toMap();
    final String namespace = (String) values.get(NAMESPACE);
    final String prefix = (String) values.get(PREFIX);

    final Namespace temp =  new NamespaceImplementation(namespace, prefix);
    return temp;
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:11,代码来源:SimpleMongoDBNamespaceManager.java

示例13: iterateNamespace

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public CloseableIteration<? extends Namespace, RyaDAOException> iterateNamespace()
        throws RyaDAOException {
    final DBObject query = new BasicDBObject();
    final DBCursor cursor = nsColl.find(query);
    return new MongoCursorIteration(cursor);
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:8,代码来源:SimpleMongoDBNamespaceManager.java

示例14: testAddNamespaces

import org.openrdf.model.Namespace; //导入依赖的package包/类
public static void testAddNamespaces(final SailRepositoryConnection conn) throws MalformedQueryException, RepositoryException,
UpdateExecutionException, QueryEvaluationException, TupleQueryResultHandlerException {

    conn.setNamespace("rya", "http://rya.com");
    final RepositoryResult<Namespace> results = conn.getNamespaces();
    for (final Namespace space : Iterations.asList(results)){
        System.out.println(space.getName() + ", " + space.getPrefix());
    }
}
 
开发者ID:apache,项目名称:incubator-rya,代码行数:10,代码来源:MongoRyaDirectExample.java

示例15: startRDF

import org.openrdf.model.Namespace; //导入依赖的package包/类
@Override
public synchronized void startRDF() throws RDFHandlerException {

    // Accept nested startRDF/endRDF calls
    if (this.depth++ > 0) {
        return;
    }

    // Initialize queue and exception holder
    this.queue = new ArrayBlockingQueue<Object>(this.queueSize);
    this.exception = new AtomicReference<Throwable>(null);

    // Run a background task to move comments, namespaces and statements off the queue and
    // forward it to the wrapped handler
    this.future = Data.getExecutor().submit(new Runnable() {

        @Override
        public void run() {
            Object object;
            try {
                DecouplingHandler.this.handler.startRDF();
                while ((object = DecouplingHandler.this.queue.take()) != EOF) {
                    if (object instanceof Statement) {
                        DecouplingHandler.this.handler.handleStatement((Statement) object);
                    } else if (object instanceof Namespace) {
                        final Namespace ns = (Namespace) object;
                        DecouplingHandler.this.handler.handleNamespace(ns.getPrefix(),
                                ns.getName());
                    } else if (object instanceof String) {
                        DecouplingHandler.this.handler.handleComment((String) object);
                    }
                }
                DecouplingHandler.this.handler.endRDF();
            } catch (final Throwable ex) {
                DecouplingHandler.this.exception.set(ex);
            }
        }

    });
}
 
开发者ID:dkmfbk,项目名称:knowledgestore,代码行数:41,代码来源:RDFUtil.java


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