本文整理汇总了Java中com.hp.hpl.jena.rdf.model.impl.StatementImpl类的典型用法代码示例。如果您正苦于以下问题:Java StatementImpl类的具体用法?Java StatementImpl怎么用?Java StatementImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StatementImpl类属于com.hp.hpl.jena.rdf.model.impl包,在下文中一共展示了StatementImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expandSubClasses
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private List<Statement> expandSubClasses(Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
+ "SELECT DISTINCT ?class ?synonym "
+ "WHERE { "
+ "?class rdfs:subClassOf+ ?subClass . "
+ "?subClass <" + synonym + "> ?synonym"
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
resultSet.forEachRemaining(querySolution -> {
stmts.add(new StatementImpl(querySolution.getResource("class"), synonym, querySolution.getLiteral("synonym")));
});
return stmts;
}
示例2: expandSubProperties
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private List<Statement> expandSubProperties(Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <" + RDFS.getURI() + ">"
+ "SELECT DISTINCT ?property ?synonym "
+ "WHERE { "
+ "?property rdfs:subPropertyOf+ ?subProperty . "
+ "?subProperty <" + synonym + "> ?synonym"
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
resultSet.forEachRemaining(querySolution -> {
stmts.add(new StatementImpl(querySolution.getResource("property"), synonym, querySolution.getLiteral("synonym")));
});
return stmts;
}
示例3: createQualityReport
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
/**
* Create instance triples corresponding towards a Quality Report
*
* @param computedOn - The resource URI of the dataset computed on
* @param problemReport - A list of quality problem as RDF Jena models
*
* @return A Jena Model which can be queried or stored
*/
public Model createQualityReport(Resource computedOn, List<String> problemReportModels){
Model m = dataset.getDefaultModel();
Resource reportURI = Commons.generateURI();
m.add(new StatementImpl(reportURI, RDF.type, QPRO.QualityReport));
m.add(new StatementImpl(reportURI, QPRO.computedOn, computedOn));
for(String prModelURI : problemReportModels){
Model prModel = getProblemReportFromTBD(prModelURI);
for(Resource r : getProblemURI(prModel)){
m.add(new StatementImpl(reportURI, QPRO.hasProblem, r));
}
m.add(prModel);
dataset.removeNamedModel(prModelURI);
}
return m;
}
示例4: createViolatingTriple
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createViolatingTriple(Statement stmt, String resource){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.ViolatingTriple));
RDFNode violatedTriple = Commons.generateRDFBlankNode();
m.add(new StatementImpl(violatedTriple.asResource(), RDF.type, RDF.Statement));
m.add(new StatementImpl(violatedTriple.asResource(), RDF.subject, stmt.getSubject()));
m.add(new StatementImpl(violatedTriple.asResource(), RDF.predicate, stmt.getPredicate()));
m.add(new StatementImpl(violatedTriple.asResource(), RDF.object, stmt.getObject()));
m.add(new StatementImpl(subject, DQMPROB.hasViolatingTriple, violatedTriple));
this._problemList.add(m);
}
示例5: getUsage
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private List<Statement> getUsage(Property property, Model model){
List<Statement> stmts = new ArrayList<Statement>();
String sparql = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
+ "PREFIX owl: <http://www.w3.org/2002/07/owl#> "
+ "SELECT DISTINCT ?concept "
+ "WHERE{"
+ " {<" + property.getURI() + "> rdfs:domain ?concept} "
+ " UNION "
+ " { "
+ " ?concept rdfs:subClassOf|owl:equivalentClass ?restriction . "
+ " ?restriction a owl:Restriction; "
+ " owl:onProperty <" + property.getURI() + "> "
+ " } "
+ "}";
Query query = QueryFactory.create(sparql, Syntax.syntaxARQ);
QueryExecution queryExecution = QueryExecutionFactory.create(query, model);
ResultSet resultSet = queryExecution.execSelect();
while(resultSet.hasNext()){
QuerySolution querySolution = resultSet.next();
Resource concept = querySolution.getResource("concept");
stmts.add(new StatementImpl(property, usage, concept));
}
return stmts;
}
示例6: getIdFromDBpedia
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
/**
* The Wikipedia Id or -1 if the Id couldn't be retrieved.
*
* FIXME The method throws an exception for "http://DBpedia.org/resource/Origin_of_the_name_"Empire_State"". this
* might be happen because of the quotes inside the URI.
*
* @param dbpediaUri
* @return
*/
@Deprecated
public static int getIdFromDBpedia(String dbpediaUri) {
int id = -1;
ParameterizedSparqlString query = new ParameterizedSparqlString(
"SELECT ?id WHERE { ?dbpedia dbo:wikiPageID ?id .}", prefixes);
query.setIri("dbpedia", dbpediaUri);
QueryExecution qexec = null;
try {
qexec = QueryExecutionFactory.create(query.asQuery(),
model);
} catch (QueryParseException e) {
LOGGER.error("Got a bad dbpediaUri \"" + dbpediaUri
+ "\" which couldn't be parse inside of a SPARQL query. Returning -1.", e);
return id;
}
ResultSet result = qexec.execSelect();
if (result.hasNext()) {
id = result.next().get("id").asLiteral().getInt();
return id;
}
qexec = QueryExecutionFactory.sparqlService(
"http://dbpedia.org/sparql", query.asQuery());
result = qexec.execSelect();
if (result.hasNext()) {
id = result.next().get("id").asLiteral().getInt();
model.add(new StatementImpl(model.createResource(dbpediaUri), model
.createProperty("http://dbpedia.org/ontology/wikiPageID"),
model.createTypedLiteral(id)));
return id;
}
model.add(new StatementImpl(model.createResource(dbpediaUri), model
.createProperty("http://dbpedia.org/ontology/wikiPageID"),
model.createTypedLiteral(id)));
return id;
}
示例7: startTopology
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
public void startTopology(Model returnModel){
ResIterator resIterator = this.createModel.listResourcesWithProperty(Omn.hasResource);
while(resIterator.hasNext()){
Resource resource = resIterator.nextResource();
Property property = returnModel.createProperty(Omn_lifecycle.hasState.getNameSpace(),Omn_lifecycle.hasState.getLocalName());
property.addProperty(RDF.type, OWL.FunctionalProperty);
Statement statement = new StatementImpl(resource, property, Omn_lifecycle.Started);
returnModel.add(statement);
}
}
示例8: extendResourcesProperties
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
public void extendResourcesProperties(Model returnModel, Model resultModel){
StmtIterator statementIterator_createModel = this.createModel.listStatements(new SimpleSelector((Resource)null, Omn.hasResource, (Object)null));
while(statementIterator_createModel.hasNext()){
Statement requestedResourceStatement = statementIterator_createModel.nextStatement();
Resource requestedResource = requestedResourceStatement.getObject().asResource();
String resource_id = this.createModel.getRequiredProperty(requestedResource, Omn_lifecycle.hasID).getString();
Resource resourceProperties = this.createModel.getResource(requestedResource.getURI());
StmtIterator stmtIterator = resultModel.listStatements(new SimpleSelector((Resource)null, Omn_lifecycle.hasID, (Object) resource_id));
while(stmtIterator.hasNext()){
Statement statement = stmtIterator.nextStatement();
Resource createdResource = statement.getSubject();
StmtIterator stmtIter = resultModel.listStatements(new SimpleSelector(createdResource, (Property)null, (RDFNode)null));
while(stmtIter.hasNext()){
Statement createdStatement = stmtIter.nextStatement();
if(!resourceProperties.hasProperty(createdStatement.getPredicate(), createdStatement.getObject())){
Statement stmt = new StatementImpl(requestedResource, createdStatement.getPredicate(), createdStatement.getObject());
returnModel.add(stmt);
}
}
}
}
}
示例9: initialize
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
@Before
public void initialize(){
Model dummyModel = ModelFactory.createDefaultModel();
Resource adapterType = dummyModel.createResource("adapter type");
Statement dummyStatement = new StatementImpl(adapterType, RDFS.subClassOf, MessageBusOntologyModel.classAdapter);
dummyModel.add(dummyStatement);
Resource resource = dummyModel.createResource("dummy resource");
adapter = new ToscaAdapter(dummyModel, resource, null);
callOpenSDNcore = new CallOpenSDNcore(dummyModel, adapter);
}
示例10: PartialStatement
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
/** Creates a partial statement from a partial triplet (subject, predicate, object).
*
* At least one of the parameter is assumed to be null.
*
* @param subject The subject of the statement
* @param predicate The predicate of the statement
* @param object The object of the statement
* @param model The ontology this partial statement refers to.
*/
public PartialStatement(Resource subject, Property predicate, RDFNode object, ModelCom model) {
stmtTokens = new ArrayList<String>();
if (subject == null) {
stmtTokens.add("?subject");
subject = model.createResource("nullSubject");
}
else
stmtTokens.add(Namespaces.toLightString(subject));
if (predicate == null) {
stmtTokens.add("?predicate");
predicate = model.createProperty("nullPredicate");
}
else
stmtTokens.add(Namespaces.toLightString(predicate));
if (object == null) {
stmtTokens.add("?object");
object = model.createResource("nullObject");
}
else
stmtTokens.add(Namespaces.toLightString(object));
baseStmt = new StatementImpl(subject, predicate, object, model);
}
示例11: createProblemModel
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createProblemModel(String resource, String expectedContentType, String actualContentType){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.MisreportedTypeException));
m.add(new StatementImpl(subject, DQMPROB.expectedContentType, m.createLiteral(expectedContentType)));
m.add(new StatementImpl(subject, DQMPROB.actualContentType, m.createLiteral(actualContentType)));
this._problemList.add(m);
}
示例12: createNotValidForwardLink
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createNotValidForwardLink(String resource){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.NotValidForwardLink));
this._problemList.add(m);
}
示例13: createProblemModel
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createProblemModel(String resource, String expectedContentType, String actualContentType){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.MisreportedTypeException));
if ((expectedContentType == null) || (expectedContentType.equals("")))
m.add(new StatementImpl(subject, DQMPROB.expectedContentType, m.createLiteral("Unknown Expected Content Type")));
else m.add(new StatementImpl(subject, DQMPROB.expectedContentType, m.createLiteral(expectedContentType)));
if ((actualContentType == null) || (actualContentType.equals("")))
m.add(new StatementImpl(subject, DQMPROB.actualContentType, m.createLiteral("Unknown Content Type")));
else
m.add(new StatementImpl(subject, DQMPROB.actualContentType, m.createLiteral(actualContentType)));
this._problemList.add(m);
}
示例14: createNotValidBacklink
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createNotValidBacklink(String resource){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.NotValidDereferenceableBackLink));
this._problemList.add(m);
}
示例15: createNotValidBackLink
import com.hp.hpl.jena.rdf.model.impl.StatementImpl; //导入依赖的package包/类
private void createNotValidBackLink(String resource){
Model m = ModelFactory.createDefaultModel();
Resource subject = m.createResource(resource);
m.add(new StatementImpl(subject, QPRO.exceptionDescription, DQMPROB.NotValidDereferenceableBackLink));
this._problemList.add(m);
}