• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java VirtGraph类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getAgentUri

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public Resource getAgentUri(VirtGraph graphOrgs, String vatId) {
	
	Resource agentUri = null;
	
	String queryUri = "PREFIX gr: <http://purl.org/goodrelations/v1#> " +
				"SELECT ?org ?vatId " +
				"FROM <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"WHERE { " +
				"?org gr:vatID ?vatId . " +
				"FILTER ( ?vatId = \"" + vatId + "\"^^<http://www.w3.org/2001/XMLSchema#string> ) " +
				"}";

	VirtuosoQueryExecution vqeUri = VirtuosoQueryExecutionFactory.create(queryUri, graphOrgs);		
	ResultSet resultsUri = vqeUri.execSelect();
	
	if (resultsUri.hasNext()) {
		QuerySolution result = resultsUri.nextSolution();
		agentUri = result.getResource("org");
	}
	
	vqeUri.close();
	
	return agentUri;
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:25,代码来源:Queries.java


示例2: getAgentUriNoVat

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public Resource getAgentUriNoVat(VirtGraph graphOrgs, String vatId) {
	
	Resource agentUri = null;
	
	String queryUri = "PREFIX gr: <http://purl.org/goodrelations/v1#> " +
				"SELECT DISTINCT ?org " +
				"FROM <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"WHERE { " +
				"?org rdf:type foaf:Organization . " +
				"FILTER (STR(?org) = \"http://linkedeconomy.org/resource/Organization/" + vatId + "\") . " +
				"}";

	VirtuosoQueryExecution vqeUri = VirtuosoQueryExecutionFactory.create(queryUri, graphOrgs);		
	ResultSet resultsUri = vqeUri.execSelect();
	
	if (resultsUri.hasNext()) {
		QuerySolution result = resultsUri.nextSolution();
		agentUri = result.getResource("org");
	}
	
	vqeUri.close();
	
	return agentUri;
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:25,代码来源:Queries.java


示例3: insertAgentUri

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
/** Insertions **/
public void insertAgentUri(VirtGraph graphOrgs, String vatId, boolean personFlag) {
	
	String insertData = null;
	String agentUri = "http://linkedeconomy.org/resource/";
	
	if (!personFlag) {
		agentUri += "Organization/" + vatId;
		insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"{ <" + agentUri + "> rdf:type gr:BusinessEntity ; " +
							   	   "rdf:type foaf:Organization ; " +
							   	   "rdf:type org:Organization ; " +
							   	   "rdf:type rov:RegisteredOrganization . " +
				"}";
	} else {
		agentUri += "Person/" + vatId;
		insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
				"{ <" + agentUri + "> rdf:type foaf:Person . }";
	}
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(agentUri + " inserted");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:26,代码来源:Queries.java


示例4: write

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
@Override
public void write(String graph, Model m) {
	
	String localServer = LLProp.getString("TripleStore.localServer");
	String user = LLProp.getString("TripleStore.user");
	String password = LLProp.getString("TripleStore.password");
	
	// connect to Virtuoso instance
	VirtGraph vg = new VirtGraph(graph, localServer, user, password);
	
	// convert triples
	Iterator<Statement> it = m.listStatements();
	while(it.hasNext()) {
		Statement s = it.next();
		vg.add(s.asTriple());
	}
	
	// close connection
	vg.close();
	
}
 
开发者ID:AKSW,项目名称:LinkingLodPortal,代码行数:22,代码来源:TripleStoreWriter.java


示例5: insertTransliteration

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
/**
    * Insert the transliterated legal name of the Organization.
    * 
    * @param VirtGraph the Organizations graph
    * @param String the URI of the Organization
    * @param String the transliterated legal name
    */
public void insertTransliteration(VirtGraph graphOrgs, String orgUri, String transLegalName) {
	
	String insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
			"{ <" + orgUri + "> elod:transliterationLegalName \"" + transLegalName + "\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " elod:transliterationLegalName inserted");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:18,代码来源:Queries.java


示例6: insertAddress

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public void insertAddress(VirtGraph graphOrgs, String orgUri, String vatId, LegalEntity legalEntity) {
	
	String addressUri = "http://linkedeconomy.org/resource/Address/" + vatId;
	
	String insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
						"{ <" + orgUri + "> vcard2006:hasAddress <" + addressUri + "> . }";
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " vcard:hasAddress inserted");
	
	insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
			"{ <" + addressUri + "> rdf:type vcard2006:Address ";
	
	if ( (legalEntity.getAddressName() != null) && (legalEntity.getAddressNumber() != null) ) {
		insertData += "; vcard2006:street-address \"" + legalEntity.getAddressName() + " " + legalEntity.getAddressNumber() + "\"@el ";
	} else if (legalEntity.getAddressName() != null) {
		insertData += "; vcard2006:street-address \"" + legalEntity.getAddressName() + "\"@el ";
	} else if (legalEntity.getAddressNumber() != null) {
		insertData += "; vcard2006:street-address \"" + legalEntity.getAddressNumber() + "\"@el ";
	}
	if (legalEntity.getPostalCode() != null) {
		insertData += "; vcard2006:postal-code \"" + legalEntity.getPostalCode() + "\"^^<http://www.w3.org/2001/XMLSchema#string> ";
	}
	if (legalEntity.getAddressRegion() != null) {
		insertData += "; vcard2006:locality \"" + legalEntity.getAddressRegion() + "\"@el ";
	}
	if (legalEntity.getCountryCode() != null) {
		insertData += "; vcard2006:country-name \"" + co.findCountryFromAbbreviation(legalEntity.getCountryCode())[0] + "\"@el ";
	}
	
	insertData += ". }";
	
	vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " Address Details added");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:40,代码来源:Queries.java


示例7: dePublishRecord

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
@Override
public void dePublishRecord(byte[] rdf, String rdfAbout, String host) {
	System.out.println("VirtuosoEndPointManager.dePublishRecord()");
	System.out.println("removing " + rdfAbout);
	if (!endpointsMap.containsKey(server + "+" + defaultGraph)) {
		System.out.println("connecting to  " + server + " for graph " + defaultGraph);
		endpointsMap.put(server + "+" + defaultGraph, new VirtGraph(defaultGraph, "jdbc:virtuoso://" + server + ":" + port, username, password));
		System.out.println("connected!");
	}
	VirtGraph virtGraph = endpointsMap.get(server + "+" + defaultGraph);

	System.out.println("dePublishRecord from " + virtGraph.getGraphName() + " -- URI -- " + rdfAbout);
	StringBuilder query = new StringBuilder();
	query.append(" DELETE FROM GRAPH <" + virtGraph.getGraphName() + "> {?bn ?a ?b}  WHERE {");
	query.append("{<" + host + rdfAbout + "> ?p ?o");
	query.append(". FILTER(isBlank(?o))");
	query.append(". ?o ?c ?s");
	query.append(". FILTER(isBlank(?s))");
	query.append(". ?s ?d ?bn");
	query.append(". FILTER(isBlank(?bn))}");
	query.append("UNION{");
	query.append("<" + host + rdfAbout + "> ?p ?o");
	query.append(". FILTER(isBlank(?o))");
	query.append(". ?o ?c ?bn");
	query.append(". FILTER(isBlank(?bn))}");
	query.append("UNION{");
	query.append(" <" + host + rdfAbout + "> ?p ?bn");
	query.append(". FILTER(isBlank(?bn))");
	query.append("} ?bn ?a ?b}");
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(query.toString(), virtGraph);
	vur.exec();
	String deleteRequest = "delete from graph <" + virtGraph.getGraphName() + "> {?s ?p ?o.} FROM <" + virtGraph.getGraphName() + "> WHERE {?s ?p ?o. FILTER(?s = <" + (rdfAbout.startsWith("http://") ? rdfAbout : host + rdfAbout) + ">)}";
	System.out.println("[bygle - info] deleteing " + deleteRequest);
	vur = VirtuosoUpdateFactory.create(deleteRequest, virtGraph);
	vur.exec();
}
 
开发者ID:regestaexe,项目名称:bygle-ldp,代码行数:37,代码来源:VirtuosoEndPointManager.java


示例8: resetEndpoint

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
@Override
public void resetEndpoint() throws Exception {
	System.out.println("VirtuosoEndPointManager.resetEndpoint()");
	if (!endpointsMap.containsKey(server + "+" + defaultGraph)) {
		System.out.println("connecting to  " + server + " for graph " + defaultGraph);
		endpointsMap.put(server + "+" + defaultGraph, new VirtGraph(defaultGraph, "jdbc:virtuoso://" + server + ":" + port, username, password));
		System.out.println("connected!");
	}
	VirtGraph virtGraph = endpointsMap.get(server + "+" + defaultDomain);
	if (virtGraph != null)
		virtGraph.clear();
}
 
开发者ID:regestaexe,项目名称:bygle-ldp,代码行数:13,代码来源:VirtuosoEndPointManager.java


示例9: deleteCube

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public String deleteCube(String namedGraph) {
	VirtGraph set = new VirtGraph(ENDPOINT, USER, PW);
       ParameterizedSparqlString prepareQuery = new ParameterizedSparqlString(CLEAR_GRAPH);
       prepareQuery.setIri("g", namedGraph);
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(prepareQuery.toString(), set);
	vur.exec();

	return null;
}
 
开发者ID:bayerls,项目名称:statistics2cubes,代码行数:10,代码来源:VirtuosoDao.java


示例10: VirtuosoResourceDAO

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public VirtuosoResourceDAO() {
    this.set = new VirtGraph(RepositorySettings.getProperty("virtuoso.host") + RepositorySettings.getProperty("virtuoso.port"),
            RepositorySettings.getProperty("virtuoso.user"), RepositorySettings.getProperty("virtuoso.password"));
    this.set.setReadFromAllGraphs(true);
    this.modelFactory = new VirtModelFactory(set);
    this.queryExecutionFactory = new VirtuosoQueryExecutionFactory();
}
 
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:8,代码来源:VirtuosoResourceDAO.java


示例11: setUp

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
@Before
public void setUp() {

    virtGraph = mock(VirtGraph.class);
    virtModel = mock(VirtModel.class);
    virtModelFactory= mock(VirtModelFactory.class);
    virtuosoQueryExecutionFactory = mock(VirtuosoQueryExecutionFactory.class);
    vqe = mock(VirtuosoQueryExecution.class);

    toTest = new VirtuosoResourceDAO(virtModelFactory, virtGraph, virtuosoQueryExecutionFactory);
}
 
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:12,代码来源:VirtuosoResourceDAOTest.java


示例12: createQueryExecution

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
@Override
protected QueryExecution createQueryExecution(String queryString,
		OntModel ontModel) {
	return VirtuosoQueryExecutionFactory.create(queryString,
			(VirtGraph) this.mdrDatabase.getJenaStore().getGraph());

}
 
开发者ID:srdc,项目名称:semanticMDR,代码行数:8,代码来源:VirtuosoQueryFactory.java


示例13: connect

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
private void connect() {
	virtGraph = new VirtGraph(null, url, username, pw, true);
	virtGraph.setQueryTimeout(QUERY_TIMEOUT_SECONDS);
	
	logger.info("Virtuoso connected to " + url);
}
 
开发者ID:sll-mdilab,项目名称:t5-doc,代码行数:7,代码来源:VirtuosoJenaRDFLoader.java


示例14: sendUpdateRequest

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
private void sendUpdateRequest(String query, VirtGraph virtGraph) {
	long startTime = System.currentTimeMillis();
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(query, virtGraph);
	vur.exec();
	logger.info("Virtuoso request took " + (System.currentTimeMillis() - startTime) + " ms.");
}
 
开发者ID:sll-mdilab,项目名称:t5-doc,代码行数:7,代码来源:VirtuosoJenaRDFLoader.java


示例15: importUpload

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public String importUpload(Model model, String context) {
//        String content = convertModelToString(model);
//        VirtGraph set = new VirtGraph(context, ENDPOINT, USER, PW);
//        Model m = ModelFactory.createDefaultModel();
//        m.read(new StringReader(content), null, Lang.N3.getName());
//        List<Triple> triples = new ArrayList<Triple>();
//        StmtIterator stmtIt = m.listStatements();
//
//        while (stmtIt.hasNext()) {
//            triples.add(stmtIt.nextStatement().asTriple());
//        }
//
//        GraphUtil.add(set, triples);
//
//        return null;


        VirtGraph set = new VirtGraph(context, ENDPOINT, USER, PW);
		StmtIterator stmtIt = model.listStatements();

		int i = 0;
		Model tempModel = ModelFactory.createDefaultModel();

		while (stmtIt.hasNext()) {
			tempModel.add(stmtIt.next());
			i++;

			if (i == BATCH_SIZE || !stmtIt.hasNext()) {
                System.out.println("batch");
                String query = "INSERT INTO ?g {";
				query += convertModelToString(tempModel);
				query += "}";

		        ParameterizedSparqlString prepareQuery = new ParameterizedSparqlString(query);
		        prepareQuery.setIri("g", context);
				VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(prepareQuery.toString(), set);
				vur.exec();
				i = 0;
				tempModel = ModelFactory.createDefaultModel();
			}
		}

		return null;
	}
 
开发者ID:bayerls,项目名称:statistics2cubes,代码行数:45,代码来源:VirtuosoDao.java


示例16: create

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public VirtuosoQueryExecution create(Query query, VirtGraph graph)
{ return virtuoso.jena.driver.VirtuosoQueryExecutionFactory.create(query, graph); }
 
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:3,代码来源:VirtuosoQueryExecutionFactory.java


示例17: VirtModelFactory

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public VirtModelFactory() {
    virtModel = new VirtModel(new VirtGraph());
}
 
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:4,代码来源:VirtModelFactory.java


示例18: insertLegalName

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public void insertLegalName(VirtGraph graphOrgs, String orgUri, String legalName) {
	
	String insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
			"{ <" + orgUri + "> gr:legalName \"" + legalName + "\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " gr:legalName inserted");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:11,代码来源:Queries.java


示例19: insertName

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public void insertName(VirtGraph graphOrgs, String orgUri, String name) {
	
	String insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
			"{ <" + orgUri + "> gr:name \"" + name + "\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " gr:name inserted");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:11,代码来源:Queries.java


示例20: insertVatId

import virtuoso.jena.driver.VirtGraph; //导入依赖的package包/类
public void insertVatId(VirtGraph graphOrgs, String orgUri, String vatId) {
	
	String insertData = "INSERT INTO GRAPH <" + QueryConfiguration.queryGraphOrganizations + "> " +
			"{ <" + orgUri + "> gr:vatID \"" + vatId + "\"^^<http://www.w3.org/2001/XMLSchema#string> . }";
	
	VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.create(insertData, graphOrgs);
	vur.exec();
	
	System.out.println(orgUri + " gr:vatID inserted");
}
 
开发者ID:YourDataStories,项目名称:harvesters,代码行数:11,代码来源:Queries.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java InvalidTypesException类代码示例发布时间:2022-05-23
下一篇:
Java DatabaseImpact类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap