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


Java SimpleSelector类代码示例

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


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

示例1: isDisambiguationResource

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public boolean isDisambiguationResource(String uri) {
    
    if(!linksLoaded){
        System.out.println(Settings.EN_DBPEDIA_DISAMBIGUATION_DATASET);
        System.out.println(Settings.DE_DBPEDIA_DISAMBIGUATION_DATASET);
        System.out.println(Settings.NL_DBPEDIA_DISAMBIGUATION_DATASET);
        InputStream in1 = FileManager.get().open( Settings.EN_DBPEDIA_DISAMBIGUATION_DATASET );
        InputStream in2 = FileManager.get().open( Settings.DE_DBPEDIA_DISAMBIGUATION_DATASET );
        InputStream in3 = FileManager.get().open( Settings.NL_DBPEDIA_DISAMBIGUATION_DATASET );
        model.read(in1, null, "N-TRIPLES");
        System.out.println("Loaded English disambiguation dataset.");
        model.read(in2, null, "N-TRIPLES");
        System.out.println("Loaded German disambiguation dataset.");
        model.read(in3, null, "N-TRIPLES");
        System.out.println("Loaded Dutch disambiguation dataset.");
        linksLoaded = true;
    }
    
    StmtIterator iter = model.listStatements( new SimpleSelector(
            ResourceFactory.createResource(uri), 
            ResourceFactory.createProperty("http://dbpedia.org/ontology/wikiPageDisambiguates"), 
                    (RDFNode)null));
    
    return iter.hasNext();
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:26,代码来源:DisambiguationPageValidator.java

示例2: getHierarchyModel

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public Model getHierarchyModel(String uri){
    
    // returns all subclasses for given URI
    Model m = ModelFactory.createDefaultModel();
    OntoRecord initRecord = new OntoRecord();
    initRecord.setUri(uri);
    
    while(initRecord !=null){
        
        initRecord = getSuperclass(initRecord.getUri());
        
        if(initRecord != null){
            StmtIterator iter1 = model.listStatements( new SimpleSelector(ResourceFactory.createResource(uri), RDFS.subClassOf,  (RDFNode)null));                
            m.add(iter1);
        }
    }
     
    return m;
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:20,代码来源:YagoOntologyManager.java

示例3: getSubclass

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public OntoRecord getSubclass(String resourceURI, String lang){
    
    StmtIterator iter1 = model.listStatements( new SimpleSelector(ResourceFactory.createResource(resourceURI), ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#subClassOf"),  (RDFNode)null));
    OntoRecord record = new OntoRecord();
    StmtIterator iter2;
    
    while(iter1.hasNext()) {
        record.setUri(iter1.next().getObject().toString());
        iter2 = model.listStatements( new SimpleSelector(ResourceFactory.createResource(record.getUri()), ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#label"),  (RDFNode)null));
        
        while(iter2.hasNext()){
            Literal res = (Literal) iter2.next().getObject();                
            String tmpLang = res.getLanguage();
            
            if( tmpLang.equals("en") ){
                record.setLabel(res.getString());
                return record;
                
            }
        }
    }
    return null;        
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:24,代码来源:DBpediaOntologyManager.java

示例4: prepare

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
@Override
public void prepare(Map conf, TopologyContext context,	OutputCollector collector) {
	this.collector = collector;
	graph = Factory.createDefaultGraph();
	startingPatternId = (String) conf.get("STARTING_PATTERN_ID");
	Resource subject = null;
	if ((conf.get(startingPatternId + "_SUBJECT")) != null) {
		subject = ResourceFactory.createResource((String) conf.get(startingPatternId + "_SUBJECT"));
	}
	Property predicate = null;
	if ((conf.get(startingPatternId + "_PREDICATE")) != null) {
		predicate = ResourceFactory.createProperty((String) conf.get(startingPatternId + "_PREDICATE"));
	}
	Resource object = null;
	if ((conf.get(startingPatternId + "_OBJECT")) != null) {
		object = ResourceFactory.createProperty((String) conf.get(startingPatternId + "_OBJECT"));
	}
	startingPattern = new SimpleSelector(subject, predicate, object);
}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:20,代码来源:Triple2GraphBolt.java

示例5: wireTopology

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
private void wireTopology() {
	
	String fileName = "data/Earthquakes-Spain-2013.ttl";
	String spoutId = "rdfStreamSpout";
	String triple2graph = "triple2graph";
	String graphCounter = "graphCounter";
	String finalCounter = "finalCounter";
	
	// TODO: Get the triple pattern from the configuration/context 
	SimpleSelector startingPattern = new SimpleSelector(null, 
			ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
			ResourceFactory.createResource("http://purl.oclc.org/NET/ssnx/ssn#FeatureOfInterest"));
	
	builder.setSpout(spoutId, new RDFStreamSpout(fileName));
	builder.setBolt(triple2graph, new Triple2GraphBolt(STARTING_PATTERN_ID)).shuffleGrouping(spoutId);
	builder.setBolt(graphCounter, new RollingCountBolt(15, 3)).fieldsGrouping(triple2graph, new Fields("name"));
	builder.setBolt(finalCounter, new AckerPrinterBolt()).globalGrouping(graphCounter);
}
 
开发者ID:allaves,项目名称:storm-query-operators,代码行数:19,代码来源:GraphCounterTopology.java

示例6: ignoreMessage

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public boolean ignoreMessage(Message rcvMessage) {
	boolean hasToIgnore = true;
	try {

		Model model = listenerAdapter.handleIgnoreMessage(rcvMessage);
		StmtIterator stmtiterator = model
				.listStatements(new SimpleSelector(null, RDF.type,
						this.adapter.getResource()));
		while (stmtiterator.hasNext()) {
			hasToIgnore = false;
			break;
		}
	} catch (Exception excep) {

	}
	return hasToIgnore;
}
 
开发者ID:FITeagle,项目名称:adapters,代码行数:18,代码来源:ResourceAdapterListener.java

示例7: getGroupDimSet

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
protected DimensionSet getGroupDimSet(Resource groupResource) throws EmptyDimensionException, NotFoundException {
    Selector selector = new SimpleSelector(groupResource, Datatype.hasDimension, (RDFNode) null);
    StmtIterator iter = model.listStatements( selector );

    DimensionSet dimSet = new DimensionSet();
    if (iter.hasNext()) {
        while (iter.hasNext()) {
            Statement s = iter.nextStatement();
            Resource dimensionResource = s.getObject().asResource();
            Dimension dim = CarbonOntology.getInstance().getDimension(getId(dimensionResource));
            dimSet.add(dim);
            if (groupResource.hasProperty(Datatype.hasHorizontalDimension, dimensionResource)) {
                dimSet.setDimensionOrientation(dim, Orientation.HORIZONTAL);
            }
            else if (groupResource.hasProperty(Datatype.hasVerticalDimension, dimensionResource)) {
                dimSet.setDimensionOrientation(dim, Orientation.VERTICAL);
            }
        }
    }
    return dimSet;
}
 
开发者ID:myclabs,项目名称:CarbonDB-reasoner,代码行数:22,代码来源:GroupRepo.java

示例8: getElementKeywords

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
protected TreeSet<Keyword> getElementKeywords(Resource elementResource) throws MalformedOntologyException {
    Selector selector = new SimpleSelector(elementResource, Datatype.hasTag, (RDFNode) null);
    StmtIterator iter = model.listStatements(selector);

    TreeSet<Keyword> keywords = new TreeSet<>();
    if (iter.hasNext()) {
        while (iter.hasNext()) {
            Statement s = iter.nextStatement();
            keywords.add(RepoFactory.getKeywordRepo().getKeyword(s.getObject().asResource()));
        }
    }
    else {
        throw new MalformedOntologyException("The element " + elementResource + " has no keyword");
    }
    return keywords;
}
 
开发者ID:myclabs,项目名称:CarbonDB-reasoner,代码行数:17,代码来源:SingleElementRepo.java

示例9: checkPrecedence

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public static boolean checkPrecedence(CompanyModel c) {

		StmtIterator stmtit = c.getModel().listStatements(
				new SimpleSelector(null, c.DEPTS, (RDFNode) null));

		List<Resource> depts = new LinkedList<Resource>();

		while (stmtit.hasNext()) {
			NodeIterator subDeptsIt = stmtit.next().getBag().iterator();
			while (subDeptsIt.hasNext())
				depts.add(subDeptsIt.next().asResource());
		}
		for (Resource dept : depts) {
			// get manager's salary
			double managerSalary = dept.getProperty(c.MANAGER).getProperty(
					c.SALARY).getDouble();
			NodeIterator employeeIt = dept.getProperty(c.EMPLOYEES).getBag()
					.iterator();
			while (employeeIt.hasNext())
				if (!(employeeIt.next().asResource().getProperty(c.SALARY)
						.getDouble() < managerSalary))
					return false;
		}

		return true;

	}
 
开发者ID:amritbhat786,项目名称:DocIT,代码行数:28,代码来源:Precedence.java

示例10: addAnon

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
private void addAnon(Model modelBase, Model modelResource, List<Statement> statementList) {
	for (int i = 0; i < statementList.size(); i++) {
		Statement statement = statementList.get(i);
		if (statement.getObject().isAnon()) {
			List<Statement> newStatementList = modelBase.listStatements(new SimpleSelector(statement.getObject().asResource(), null, null, null)).toList();
			modelResource.add(newStatementList);
			addAnon(modelBase, modelResource, newStatementList);
		}
	}
}
 
开发者ID:regestaexe,项目名称:bygle-ldp,代码行数:11,代码来源:JenaEndPointManager.java

示例11: getStringLiteral

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public static String getStringLiteral(Model model, Resource resource, Property property) {
    String result=null;
    StmtIterator listStatements = model.listStatements(new SimpleSelector(resource,property,(String)null));
    if(listStatements.hasNext()) {
        result=((Statement)listStatements.next()).getLiteral().getString();
    }
    logger.debug("String literal: "+result);
    return result;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:10,代码来源:RdfModel.java

示例12: getLongLiteral

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public static long getLongLiteral(Model model, Resource resource, Property property) {
    long result=0;
    StmtIterator listStatements = model.listStatements(new SimpleSelector(resource,property,(Long)null));
    if(listStatements.hasNext()) {
        result=((Statement)listStatements.next()).getLiteral().getLong();
    }
    logger.debug("Long literal: "+result);
    return result;
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:10,代码来源:RdfModel.java

示例13: mapEnResource

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public String mapEnResource(String h) {
    
    StmtIterator iter = enModel.listStatements( new SimpleSelector(ResourceFactory.createResource(h), ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#subClassOf"),  (RDFNode)null));
    String ontoType = null;
    while(iter.hasNext()) {
        ontoType = iter.next().getObject().toString();            
    }
    return ontoType;
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:10,代码来源:DBpediaOntologyMapper.java

示例14: mapDeResource

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public String mapDeResource(String h) {
    
    StmtIterator iter = deModel.listStatements( new SimpleSelector(ResourceFactory.createResource(h), ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#subClassOf"),  (RDFNode)null));
    String ontoType = null;
    while(iter.hasNext()) {
        ontoType = iter.next().getObject().toString();            
    }
    return ontoType;
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:10,代码来源:DBpediaOntologyMapper.java

示例15: mapNlResource

import com.hp.hpl.jena.rdf.model.SimpleSelector; //导入依赖的package包/类
public String mapNlResource(String h) {
    
    StmtIterator iter = nlModel.listStatements( new SimpleSelector(ResourceFactory.createResource(h), ResourceFactory.createProperty("http://www.w3.org/2000/01/rdf-schema#subClassOf"),  (RDFNode)null));
    String ontoType = null;
    while(iter.hasNext()) {
        ontoType = iter.next().getObject().toString();            
    }
    return ontoType;
}
 
开发者ID:entityclassifier-eu,项目名称:entityclassifier-core,代码行数:10,代码来源:DBpediaOntologyMapper.java


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