现在的位置: 首页 > 搜索技术 > 正文

开源项目-空间数据搜索引擎客户端(GenetworkClient)

2018年02月20日 搜索技术 ⁄ 共 2416字 ⁄ 字号 评论关闭

1 介绍

GeoNetwork是空间信息领域中的目录服务软件,它是一个基于Java实现的开源软件,使用Lucene实现空间资源的全文检索。

GentworkClient 是本人开发的一个Java 库,是开源软件Genetwork的客户端实现,目标是提供一个简单易用的API来添加、删除、修改和查询Genetwork中的空间资源。

2 GenetworkClient API


package cn.ac.registAService.service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import cn.ac.registAService.commons.util.Pair;
import cn.ac.registAService.commons.util.Pair.Three;
import cn.ac.registAService.exception.BusinessException;
import cn.ac.registAService.model.MetadataIso;
import cn.ac.registAService.model.User;

/** 
 * @author  zhonghua  
 * @version 1.0
 * @date    2012-9-28 下午3:34:06 
 * @fuction 资源元数据管理接口
 */
public interface IMetadataManager {

	/**
	 * 资源添加
	 * @param metadataIso
	 * 资源元数据
	 * @return
	 * true添加成功,false添加失败
	 * @throws BusinessException 
	 */
	public boolean insert(MetadataIso metadataIso) throws BusinessException;
	
	/**
	 * 资源修改
	 * @param metadataXml
	 * 资源元数据
	 * @return
	 * true修改成功,false修改失败
	 * @throws BusinessException 
	 */
	public boolean update(MetadataIso metadataIso) throws BusinessException;
	
	/**
	 * 资源删除
	 * @param id
	 * 资源元数据id
	 * @return
	 * true删除成功,false添加删除失败
	 * @throws BusinessException 
	 */
    public boolean delete(String id) throws BusinessException;
    
	/**
	 * 获取资源组织
	 * @return Map<资源组织名称,拥有的资源数目>
	 * @throws BusinessException
	 */
    public Map<String,String> getOrganization() throws BusinessException ;
    
    /**
     * 根据uuid查询符合条件的资源
     * @param id
     * 资源元数据uuid
     * @return 
     * 返回查询结果,查询结果是符合资源元数据模型标准的描述
     * @throws BusinessException 
     */
    public MetadataIso getRecordById(String id) throws BusinessException;
    
    /**
     * 查询全部资源
     * @return
     * @throws BusinessException
     */
    public List<MetadataIso> getRecords()throws BusinessException;
        
    /**
     * 根据查询语句查询符合条件的资源
     * @param strQuery 查询条件,strQuery 为null时,全文查询
     * @param maxRecords  最多返回符合查询结果的数目,如果为0,则返回全部查询结果
     * @return Pair<String, List<MetadataIso>>
     * String 符合查询条件的资源数目
     * List<MetadataIso> 查询到的资源
     * @throws BusinessException
     */
    public Pair<String, List<MetadataIso>> getRecords(String strQuery,long maxRecords,long startPosition)throws BusinessException;
	
	/**
	 * 得到GetRecords查询的所有信息,包括summary信息
	 * @param strQuery 查询条件
	 * @param maxRecords 最多返回符合查询结果的数目,如果为0,则返回全部查询结果
	 * @param startPosition 开始获取数据的位置(从1开始),利用这个位置可以实现分页功能。如果设置为0,则startPosition不起作用
	 * @return Three<String, Map<String, String>, List<MetadataIso>>
	 * String 符合查询条件的资源数目
	 * Map<String, String>存放summary中的信息(目前只存资源组织信息<资源组织名称,资源数目>,后期可扩展存储服务等信息)
	 * List<MetadataIso>>存放返回的资源信息
	 * @throws BusinessException
	 */
	public Three<String, Map<String, String>, List<MetadataIso>> getRecordsAllInfor(String strQuery,long maxRecords,long startPosition) throws BusinessException; 	
	
}

3 使用例子

Code Exemple 

4 开源代码

GenetworkClient Source Code 

5 使用文档

Doc

抱歉!评论已关闭.