本文整理匯總了Java中com.hp.hpl.jena.rdf.model.Model.setNsPrefix方法的典型用法代碼示例。如果您正苦於以下問題:Java Model.setNsPrefix方法的具體用法?Java Model.setNsPrefix怎麽用?Java Model.setNsPrefix使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.hp.hpl.jena.rdf.model.Model
的用法示例。
在下文中一共展示了Model.setNsPrefix方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setPrefixes
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
* Add the necessary prefixes to the model we are currently
* working with.
*
* @param Model the model we are currently working with
*/
public void setPrefixes(Model model) {
model.setNsPrefix("elod", Ontology.eLodPrefix);
model.setNsPrefix("elodGeo", Ontology.elodGeoPrefix);
model.setNsPrefix("pc", Ontology.publicContractsPrefix);
model.setNsPrefix("skos", Ontology.skosPrefix);
model.setNsPrefix("gr", Ontology.goodRelationsPrefix);
model.setNsPrefix("rov", Ontology.regOrgPrefix);
model.setNsPrefix("org", Ontology.orgPrefix);
model.setNsPrefix("foaf", Ontology.foafPrefix);
model.setNsPrefix("xsd", Ontology.xsdPrefix);
model.setNsPrefix("dcterms", Ontology.dctermsPrefix);
model.setNsPrefix("dc", Ontology.dcPrefix);
model.setNsPrefix("pcdt", Ontology.pcdtPrefix);
model.setNsPrefix("vcard", Ontology.vcardPrefix);
}
示例2: setPrefixes
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
* Add the necessary prefixes to the model we are currently working with.
*
* @param Model
* the model we are currently working with
*/
public void setPrefixes(Model model) {
model.setNsPrefix("elod", Ontology.eLodPrefix);
model.setNsPrefix("elodGeo", Ontology.elodGeoPrefix);
model.setNsPrefix("pc", Ontology.publicContractsPrefix);
model.setNsPrefix("skos", Ontology.skosPrefix);
model.setNsPrefix("gr", Ontology.goodRelationsPrefix);
model.setNsPrefix("rov", Ontology.regOrgPrefix);
model.setNsPrefix("org", Ontology.orgPrefix);
model.setNsPrefix("foaf", Ontology.foafPrefix);
model.setNsPrefix("xsd", Ontology.xsdPrefix);
model.setNsPrefix("dcterms", Ontology.dctermsPrefix);
model.setNsPrefix("dc", Ontology.dcPrefix);
model.setNsPrefix("pcdt", Ontology.pcdtPrefix);
model.setNsPrefix("vcard", Ontology.vcardPrefix);
}
示例3: subprojectsSellers
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
public static void subprojectsSellers() {
//services for each table
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
SubProjectSellersService sub = (SubProjectSellersService) ctx.getBean("subProjectSellersServiceImpl");
List<SubProjectSellers> subProjectSeller = sub.getSubProjectSellers();
//--------------RDF Model--------------//
Model model = ModelFactory.createDefaultModel();
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, model);
model.setNsPrefix("elod", OntologySpecification.elodPrefix);
model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
for (SubProjectSellers subProjectSeller1 : subProjectSeller) {
Resource instanceSeller = infModel.createResource(OntologySpecification.instancePrefix
+ "Organization/" + subProjectSeller1.getSellerId());
Resource instanceSubProject = infModel.createResource(OntologySpecification.instancePrefix
+ "Subproject/" + subProjectSeller1.getOps() + "/" + subProjectSeller1.getSubProjectId());
infModel.add(instanceSeller, RDF.type, OntologySpecification.organizationResource);
infModel.add(instanceSeller, RDF.type, OntologySpecification.businessResource);
infModel.add(instanceSubProject, RDF.type, OntologySpecification.subProjectResource);
instanceSubProject.addProperty(OntologySpecification.seller, instanceSeller);
}
try {
FileOutputStream fout = new FileOutputStream(
"/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/subProjectSellersEspa.rdf");
model.write(fout);
} catch (IOException e) {
System.out.println("Exception caught" + e.getMessage());
}
}
示例4: espaSellers
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
public static void espaSellers() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
SellersService sellers = (SellersService) ctx.getBean("sellersServiceImpl");
List<Sellers> seller = sellers.getSellers();
//--------------RDF Model--------------//
Model model = ModelFactory.createDefaultModel();
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, model);
model.setNsPrefix("elod", OntologySpecification.elodPrefix);
model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
model.setNsPrefix("vcard", OntologySpecification.vcardPrefix);
for (Sellers seller1 : seller) {
Resource instanceSeller = infModel.createResource(OntologySpecification.instancePrefix + "Organization/" + seller1.getId());
infModel.add(instanceSeller, RDF.type, OntologySpecification.organizationResource);
instanceSeller.addProperty(OntologySpecification.name, seller1.getEponimia(), XSDDatatype.XSDstring);
}
try {
FileOutputStream fout = new FileOutputStream(
"/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/sellersEspa.rdf");
model.write(fout);
} catch (IOException e) {
System.out.println("Exception caught" + e.getMessage());
}
}
示例5: setPrefixes
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
private static void setPrefixes(Model model) {
model.setNsPrefix(DAQ.PREFIX, DAQ.NS);
model.setNsPrefix(DQV.PREFIX, DQV.NS);
model.setNsPrefix(QMO.PREFIX, QMO.NS);
model.setNsPrefix(LDQ.PREFIX, LDQ.NS);
model.setNsPrefix(EVAL.PREFIX, EVAL.NS);
model.setNsPrefix(SKOS.PREFIX, SKOS.NS);
model.setNsPrefix(PROV.PREFIX, PROV.NS);
model.setNsPrefix(QPRO.PREFIX, QPRO.NS);
model.setNsPrefix(HTTP.PREFIX, HTTP.NS);
model.setNsPrefix(OM.PREFIX, OM.NS);
model.setNsPrefix("rdf", RDF.getURI());
model.setNsPrefix("dc", DC_11.getURI());
model.setNsPrefix("dcterms", DCTerms.getURI());
model.setNsPrefix("xsd", XSD.getURI());
model.setNsPrefix("owl", OWL.getURI());
model.setNsPrefix("dqm", "http://www.diachron-fp7.eu/dqm#");
model.setNsPrefix("dbr", "http://dbpedia.org/resource/");
model.setNsPrefix("uri4uri", "http://uri4uri.net/vocab#");
model.setNsPrefix("derivedmeasure", "http://linkeddata.es/resource/ldqm/DerivedMeasure/");
model.setNsPrefix("basemeasure", "http://linkeddata.es/resource/ldqm/BaseMeasure/");
model.setNsPrefix("indicator", "http://linkeddata.es/resource/ldqm/QualityIndicator/");
model.setNsPrefix("category", "http://linkeddata.es/resource/ldqm/SubjectCategory/");
model.setNsPrefix("dimension", "http://linkeddata.es/resource/ldqm/Dimension/");
model.setNsPrefix("defect", "http://linkeddata.es/resource/ldqm/Defect/");
model.setNsPrefix("scale", "http://linkeddata.es/resource/ldqm/Scale/");
model.setNsPrefix("technique", "http://linkeddata.es/resource/ldqm/AssessmentTechnique/");
model.setNsPrefix("measure", "http://linkeddata.es/resource/ldqm/measure/");
model.setNsPrefix("evaluation", "http://linkeddata.es/resource/ldqm/evaluation/");
model.setNsPrefix("report", "http://linkeddata.es/resource/ldqm/report/");
}
示例6: createModel
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
private Model createModel() {
Model model = ModelFactory.createDefaultModel();
String NS = "http://www.computas.no/zebra/";
model.setNsPrefix("", NS);
model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#");
Resource subject = model.createResource(NS + "Joe");
Property predicate = model.createProperty(NS + "hasSentMessage");
String object = "Hello World!";
subject.addProperty(predicate, object, XSDDatatype.XSDstring);
return model;
}
示例7: createModel
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
private Model createModel() {
Model model = ModelFactory.createDefaultModel();
String NS = "http://www.computas.no/zebra/";
model.setNsPrefix("", NS);
model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#");
//TODO
return model;
}
示例8: espaSubprojects
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
public static void espaSubprojects() throws ParseException {
//services for each table
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
SubProjectsService sub = (SubProjectsService) ctx.getBean("subProjectsServiceImpl");
List<SubProjects> subProject = sub.getSubProjects();
//--------------RDF Model--------------//
Model model = ModelFactory.createDefaultModel();
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, model);
model.setNsPrefix("elod", OntologySpecification.elodPrefix);
model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
model.setNsPrefix("dcterms", OntologySpecification.dctermsPrefix);
//number format
DecimalFormat df = new DecimalFormat("0.00");
for (SubProjects subProject1 : subProject) {
Resource instanceCurrency = infModel.createResource("http://linkedeconomy.org/resource/Currency/EUR");
Resource instanceBudgetUps = infModel.createResource(OntologySpecification.instancePrefix
+ "UnitPriceSpecification/BudgetItem/" + subProject1.getOps() + "/" + subProject1.getId());
Resource instanceBudget = infModel.createResource(OntologySpecification.instancePrefix + "BudgetItem/" + subProject1.getOps() + "/" + subProject1.getId());
Resource instanceSubProject = infModel.createResource(OntologySpecification.instancePrefix + "Subproject/" + subProject1.getOps() + "/" + subProject1.getId());
Resource instanceProject = infModel.createResource(OntologySpecification.instancePrefix
+ "Subsidy/" + subProject1.getOps());
DateFormat dfDate = new SimpleDateFormat("dd/MM/yyyy");
DateFormat df2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
java.util.Date stDateStarts;
java.util.Date stDateEnds;
stDateStarts = dfDate.parse(subProject1.getStart());
stDateEnds = dfDate.parse(subProject1.getFinish());
String startDate = df2.format(stDateStarts);
String endDate = df2.format(stDateEnds);
infModel.add(instanceProject, RDF.type, OntologySpecification.projectResource);
infModel.add(instanceBudgetUps, RDF.type, OntologySpecification.priceSpecificationResource);
infModel.add(instanceBudget, RDF.type, OntologySpecification.budgetResource);
infModel.add(instanceSubProject, RDF.type, OntologySpecification.subProjectResource);
instanceProject.addProperty(OntologySpecification.hasRelatedProject, instanceSubProject);
instanceSubProject.addProperty(OntologySpecification.hasRelatedBudgetItem, instanceBudget);
instanceBudget.addProperty(OntologySpecification.price, instanceBudgetUps);
instanceBudgetUps.addProperty(OntologySpecification.hasCurrencyValue, df.format(subProject1.getBudget()), XSDDatatype.XSDfloat);
instanceBudgetUps.addProperty(OntologySpecification.valueAddedTaxIncluded, "true", XSDDatatype.XSDboolean);
instanceBudgetUps.addProperty(OntologySpecification.hasCurrency, instanceCurrency);
instanceSubProject.addProperty(OntologySpecification.startDate, startDate, XSDDatatype.XSDdateTime);
instanceSubProject.addProperty(OntologySpecification.endDate, endDate, XSDDatatype.XSDdateTime);
instanceSubProject.addProperty(OntologySpecification.title, String.valueOf(subProject1.getTitle()), "el");
}
try {
FileOutputStream fout = new FileOutputStream(
"/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/subProjectEspa.rdf");
model.write(fout);
} catch (IOException e) {
System.out.println("Exception caught" + e.getMessage());
}
}
示例9: espaBuyers
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
public static void espaBuyers() {
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
BuyersService buyers = (BuyersService) ctx.getBean("buyersServiceImpl");
List<Buyers> buyer = buyers.getBuyers();
List<Buyer> projectBuyer = buyers.getProjectBuyers();
//--------------RDF Model--------------//
Model model = ModelFactory.createDefaultModel();
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, model);
model.setNsPrefix("elod", OntologySpecification.elodPrefix);
model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
model.setNsPrefix("vcard", OntologySpecification.vcardPrefix);
for (Buyer projectBuyer1 : projectBuyer) {
Resource instanceBuyer = infModel.createResource(OntologySpecification.instancePrefix + "Organization/" + projectBuyer1.getBuyerId());
Resource instanceProject = infModel.createResource(OntologySpecification.instancePrefix + "Subsidy/" + projectBuyer1.getOps());
infModel.add(instanceBuyer, RDF.type, OntologySpecification.organizationResource);
infModel.add(instanceProject, RDF.type, OntologySpecification.subsidyResource);
instanceProject.addProperty(OntologySpecification.beneficiary, instanceBuyer);
instanceBuyer.addProperty(OntologySpecification.name, String.valueOf(projectBuyer1.getEponimia()), XSDDatatype.XSDstring);
}
try {
FileOutputStream fout = new FileOutputStream(
"/Users/giovaf/Documents/yds_pilot1/espa_tests/22-02-2016_ouput/buyersEspa.rdf");
// /home/svaf/buyersEspa.rdf
// /Users/giovaf/Documents/yds_pilot1/espa_tests/06-01-2016_output/buyersEspa.rdf
model.write(fout);
} catch (IOException e) {
System.out.println("Exception caught" + e.getMessage());
}
}
示例10: exportRfd
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
/**
*
* Implementation Of Subproject Service layer
* and transformation of Database data to RDF
*
* @throws java.text.ParseException
* @throws java.io.UnsupportedEncodingException
* @throws java.io.FileNotFoundException
*/
public static void exportRfd() throws ParseException, UnsupportedEncodingException, FileNotFoundException, IOException {
//services for each table
ApplicationContext ctx = new ClassPathXmlApplicationContext("spring.xml");
SubProjectsService sub = (SubProjectsService) ctx.getBean("subProjectsServiceImpl");
List<SubprojectsProjects> subProject = sub.getInfoSubproject();
//--------------RDF Model--------------//
Model model = ModelFactory.createDefaultModel();
Reasoner reasoner = ReasonerRegistry.getOWLReasoner();
InfModel infModel = ModelFactory.createInfModel(reasoner, model);
model.setNsPrefix("elod", OntologySpecification.elodPrefix);
model.setNsPrefix("gr", OntologySpecification.goodRelationsPrefix);
model.setNsPrefix("dcterms", OntologySpecification.dctermsPrefix);
//number format
DecimalFormat df = new DecimalFormat("0.00");
for (SubprojectsProjects subProject1 : subProject) {
Resource instanceCurrency = infModel.createResource("http://linkedeconomy.org/resource/Currency/EUR");
Resource instanceUps = infModel.createResource(OntologySpecification.instancePrefix
+ "UnitPriceSpecification/" + subProject1.getOps() + "/" + subProject1.getSubprojectId());
Resource instanceBudget = infModel.createResource(OntologySpecification.instancePrefix + "BudgetItem/" + subProject1.getOps() + "/" + subProject1.getSubprojectId());
Resource instanceSubProject = infModel.createResource(OntologySpecification.instancePrefix + "Contract/" + subProject1.getOps() + "/" + subProject1.getSubprojectId());
Resource instanceProject = infModel.createResource(OntologySpecification.instancePrefix
+ "PublicWork/" + subProject1.getOps());
infModel.add(instanceUps, RDF.type, OntologySpecification.priceSpecificationResource);
infModel.add(instanceBudget, RDF.type, OntologySpecification.budgetResource);
infModel.add(instanceSubProject, RDF.type, OntologySpecification.contractResource);
instanceProject.addProperty(OntologySpecification.hasRelatedContract, instanceSubProject);
instanceSubProject.addProperty(OntologySpecification.price, instanceUps);
instanceUps.addProperty(OntologySpecification.hasCurrencyValue, df.format(subProject1.getBudget()), XSDDatatype.XSDfloat);
instanceUps.addProperty(OntologySpecification.valueAddedTaxIncluded, "true", XSDDatatype.XSDboolean);
instanceUps.addProperty(OntologySpecification.hasCurrency, instanceCurrency);
if (subProject1.getStart() != null) {
instanceSubProject.addProperty(OntologySpecification.pcStartDate, subProject1.getStart().replace("/", "-"), XSDDatatype.XSDdate);
}
if (subProject1.getFinish() != null) {
instanceSubProject.addProperty(OntologySpecification.actualEndDate, subProject1.getFinish().replace("/", "-"), XSDDatatype.XSDdate);
}
instanceSubProject.addProperty(OntologySpecification.title, String.valueOf(subProject1.getTitle()), "el");
}
try {
FileOutputStream fout = new FileOutputStream(
CommonVariables.serverPath + "subProjectEspa_"+ CommonVariables.currentDate + ".rdf");
model.write(fout);
fout.close();
} catch (IOException e) {
System.out.println("Exception caught" + e.getMessage());
}
}
示例11: testUsePrefixMappingWhenPrintingURIResources
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
@Test
public void testUsePrefixMappingWhenPrintingURIResources() {
Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("ex", "http://example.org/");
assertEquals("ex:foo", PrettyPrinter.toString(m.createResource("http://example.org/foo")));
}
示例12: doGet
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
protected void doGet(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
D2RServer server = D2RServer.fromServletContext(getServletContext());
server.checkMappingFileChanged();
String relativeResourceURI = request.getRequestURI().substring(
request.getContextPath().length()
+ request.getServletPath().length());
// Some servlet containers keep the leading slash, some don't
if (!"".equals(relativeResourceURI)
&& "/".equals(relativeResourceURI.substring(0, 1))) {
relativeResourceURI = relativeResourceURI.substring(1);
}
if (request.getQueryString() != null) {
relativeResourceURI = relativeResourceURI + "?"
+ request.getQueryString();
}
/* Determine service stem, i.e. vocab/ in /[vocab/]data */
int servicePos;
if (-1 == (servicePos = request.getServletPath().indexOf(
"/" + D2RServer.getDataServiceName())))
throw new ServletException("Expected to find service path /"
+ D2RServer.getDataServiceName());
String serviceStem = request.getServletPath().substring(1,
servicePos + 1);
String resourceURI = RequestParamHandler
.removeOutputRequestParam(server.resourceBaseURI(serviceStem)
+ relativeResourceURI);
String documentURL = server.dataURL(serviceStem, relativeResourceURI);
String pageURL = server.pageURL(serviceStem, relativeResourceURI);
String sparqlQuery = "DESCRIBE <" + resourceURI + ">";
QueryExecution qe = QueryExecutionFactory.create(sparqlQuery,
server.dataset());
if (server.getConfig().getPageTimeout() > 0) {
qe.setTimeout(Math.round(server.getConfig().getPageTimeout() * 1000));
}
Model description = qe.execDescribe();
qe.close();
if (description.size() == 0) {
response.sendError(404);
}
if (description.qnameFor(FOAF.primaryTopic.getURI()) == null
&& description.getNsPrefixURI("foaf") == null) {
description.setNsPrefix("foaf", FOAF.NS);
}
Resource resource = description.getResource(resourceURI);
Resource document = description.getResource(documentURL);
document.addProperty(FOAF.primaryTopic, resource);
Statement label = resource.getProperty(RDFS.label);
if (label != null) {
document.addProperty(RDFS.label,
"RDF Description of " + label.getString());
}
server.addDocumentMetadata(description, document);
if (server.getConfig().serveMetadata()) {
// add document metadata from template
Model resourceMetadataTemplate = server.getConfig().getResourceMetadataTemplate(
server, getServletContext());
MetadataCreator resourceMetadataCreator = new MetadataCreator(
server, resourceMetadataTemplate);
description.add(resourceMetadataCreator.addMetadataFromTemplate(
resourceURI, documentURL, pageURL));
Map<String, String> descPrefixes = description.getNsPrefixMap();
descPrefixes.putAll(resourceMetadataTemplate.getNsPrefixMap());
description.setNsPrefixes(descPrefixes);
}
// TODO: Add a Content-Location header
new ModelResponse(description, request, response).serve();
}
示例13: testUsePrefixMappingWhenPrintingURIResources
import com.hp.hpl.jena.rdf.model.Model; //導入方法依賴的package包/類
public void testUsePrefixMappingWhenPrintingURIResources() {
Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("ex", "http://example.org/");
assertEquals("ex:foo", PrettyPrinter.toString(m.createResource("http://example.org/foo")));
}