public class QueryOperation extends Object
Constructor and Description |
---|
QueryOperation() |
Modifier and Type | Method and Description |
---|---|
static org.semanticweb.owlapi.model.OWLOntology |
convertModel(org.apache.jena.rdf.model.Model model)
Deprecated.
|
static org.semanticweb.owlapi.model.OWLOntology |
convertModel(org.apache.jena.rdf.model.Model model,
IOHelper ioHelper,
String catalogPath)
Given a Model, an IOHelper, and a path to an XML catalog, convert the model to an OWLOntology
object.
|
static int |
countResults(org.apache.jena.query.ResultSet results)
Count results.
|
static org.apache.jena.query.Dataset |
createEmptyDataset() |
static org.apache.jena.rdf.model.Model |
execConstruct(org.apache.jena.sparql.core.DatasetGraph dsg,
String query)
Deprecated.
use
execConstruct(Dataset, String) instead. |
static org.apache.jena.rdf.model.Model |
execConstruct(org.apache.jena.query.Dataset dataset,
String query)
Execute a SPARQL CONSTRUCT query on a dataset and return a model.
|
static org.apache.jena.query.ResultSet |
execQuery(org.apache.jena.sparql.core.DatasetGraph dsg,
String query)
Deprecated.
use
execQuery(Dataset, String) instead. |
static org.apache.jena.query.ResultSet |
execQuery(org.apache.jena.query.Dataset dataset,
String query)
Execute a SPARQL SELECT query on a dataset and return a result set.
|
static void |
execUpdate(org.apache.jena.rdf.model.Model model,
String updateString)
Given a Model and a SPARQL update (as string), update the model.
|
static boolean |
execVerify(org.apache.jena.sparql.core.DatasetGraph dsg,
String ruleName,
String query)
Deprecated.
use
execVerify(Dataset, String, String) instead |
static boolean |
execVerify(org.apache.jena.query.Dataset dataset,
String ruleName,
String query)
Given a dataset to query, a rule name, and the query string, execute the query over the
dataset.
|
static boolean |
execVerify(Map<File,Tuple<org.apache.jena.query.ResultSetRewindable,OutputStream>> queriesResults)
Deprecated.
previously used as test method.
|
static String |
getDefaultFormatName(org.apache.jena.query.Query query)
Given a SPARQL query, return its default file format as a string.
|
static String |
getDefaultFormatName(String query)
Given a SPARQL query, return its default file format as a string.
|
static org.apache.jena.riot.Lang |
getFormatLang(String formatName)
Convert a format name string to a language code.
|
static String |
getQueryTypeName(String queryString)
Given a SPARQL query, return its type as a string: ASK, CONSTRUCT, DESCRIBE, or SELECT.
|
static boolean |
hasResult(org.apache.jena.rdf.model.Model result)
If a model has statements, return true, otherwise false.
|
static boolean |
hasResult(org.apache.jena.query.ResultSet result)
If a result set has results, return true, otherwise false.
|
static org.apache.jena.sparql.core.DatasetGraph |
loadOntology(org.semanticweb.owlapi.model.OWLOntology ontology)
Deprecated.
use
loadOntologyAsDataset(OWLOntology) instead. |
static org.apache.jena.query.Dataset |
loadOntologyAsDataset(org.semanticweb.owlapi.model.OWLOntology ontology)
Given an ontology, return a dataset containing that ontology as the only graph.
|
static org.apache.jena.query.Dataset |
loadOntologyAsDataset(org.semanticweb.owlapi.model.OWLOntology ontology,
boolean useGraphs)
Given an ontology and a boolean indicating if imports should be included as graphs, return a
dataset either with just the ontology, or the ontology and its imports as separate graphs.
|
static org.apache.jena.rdf.model.Model |
loadOntologyAsModel(org.semanticweb.owlapi.model.OWLOntology ontology)
Given an OWLOntology, return the Model representation of the axioms.
|
static org.apache.jena.query.Dataset |
loadTriplesAsDataset(String inputPath,
String tdbDir)
Deprecated.
|
static boolean |
maybeWriteResult(org.apache.jena.rdf.model.Model result,
String formatName,
OutputStream output)
If a model has statements, write to the output stream and return true.
|
static boolean |
maybeWriteResult(org.apache.jena.query.ResultSet result,
String formatName,
OutputStream output)
If a result set has results, write to the output stream and return true.
|
static void |
runConstruct(org.apache.jena.query.Dataset dataset,
String query,
File output,
org.apache.jena.riot.Lang outputFormat)
Run a CONSTRUCT query and write the result to a file.
|
static void |
runQuery(org.apache.jena.sparql.core.DatasetGraph dsg,
String query,
File output,
org.apache.jena.riot.Lang outputFormat)
Deprecated.
use
runQuery(Dataset, String, File, Lang) instead. |
static void |
runQuery(org.apache.jena.query.Dataset dataset,
String query,
File output,
org.apache.jena.riot.Lang outputFormat)
Run a SELECT query on a dataset and write the result to a file.
|
static boolean |
runSparqlQuery(org.apache.jena.sparql.core.DatasetGraph dsg,
String query,
String formatName,
OutputStream output)
Deprecated.
|
static boolean |
runSparqlQuery(org.apache.jena.query.Dataset dataset,
String queryString,
String formatName,
OutputStream output)
Given a dataset, a query string, a format name, and an output stream, run the SPARQL query over
the named graphs and write the output to the stream.
|
static boolean |
runSparqlQuery(org.apache.jena.query.QueryExecution qExec,
String formatName,
OutputStream output)
Given a query execution, a format name, and an output stream, run the query and write to
output.
|
static void |
runUpdate(org.apache.jena.rdf.model.Model model,
String updateString,
File output,
org.apache.jena.riot.Lang outputFormat)
Given a Model, a SPARQL update string, an output stream, and the output format, update the
model and write it to the output.
|
static boolean |
runVerify(org.apache.jena.sparql.core.DatasetGraph dsg,
String ruleName,
String query,
Path outputPath,
org.apache.jena.riot.Lang outputFormat)
Deprecated.
use
runVerify(Dataset, String, String, Path, Lang) instead. |
static boolean |
runVerify(org.apache.jena.query.Dataset dataset,
String ruleName,
String query,
Path outputPath,
org.apache.jena.riot.Lang outputFormat)
Run a SELECT query over the union of named graphs in a dataset and write the result to a file.
|
static void |
writeResult(boolean result,
OutputStream output)
Write a boolean result to an output stream.
|
static void |
writeResult(org.apache.jena.rdf.model.Model model,
org.apache.jena.riot.Lang format,
OutputStream output)
Write a model to an output stream.
|
static void |
writeResult(org.apache.jena.rdf.model.Model model,
String formatName,
OutputStream output)
Write a model to an output stream.
|
static void |
writeResult(org.apache.jena.query.ResultSet resultSet,
org.apache.jena.riot.Lang format,
OutputStream output)
Write a result set to an output stream.
|
static void |
writeResult(org.apache.jena.query.ResultSet resultSet,
String formatName,
OutputStream output)
Write a result set to an output stream.
|
@Deprecated public static org.apache.jena.sparql.core.DatasetGraph loadOntology(org.semanticweb.owlapi.model.OWLOntology ontology) throws org.semanticweb.owlapi.model.OWLOntologyStorageException
loadOntologyAsDataset(OWLOntology)
instead.ontology
- The ontology to load into the graphorg.semanticweb.owlapi.model.OWLOntologyStorageException
- rarelypublic static org.apache.jena.query.Dataset loadOntologyAsDataset(org.semanticweb.owlapi.model.OWLOntology ontology) throws org.semanticweb.owlapi.model.OWLOntologyStorageException
ontology
- ontology to queryorg.semanticweb.owlapi.model.OWLOntologyStorageException
- on issue converting ontology Jena modelpublic static org.apache.jena.query.Dataset loadOntologyAsDataset(org.semanticweb.owlapi.model.OWLOntology ontology, boolean useGraphs) throws org.semanticweb.owlapi.model.OWLOntologyStorageException
ontology
- ontology to queryuseGraphs
- if true, load imports as separate graphsorg.semanticweb.owlapi.model.OWLOntologyStorageException
- on issue converting ontology Jena modelpublic static org.apache.jena.rdf.model.Model loadOntologyAsModel(org.semanticweb.owlapi.model.OWLOntology ontology) throws org.semanticweb.owlapi.model.OWLOntologyStorageException
ontology
- OWLOntology to convert to Modelorg.semanticweb.owlapi.model.OWLOntologyStorageException
- on issue rendering ontology to triples@Deprecated public static org.apache.jena.query.Dataset loadTriplesAsDataset(String inputPath, String tdbDir)
IOHelper.loadToTDBDataset(String, String)
WARNING - this creates a directory at given tdbDir location!
inputPath
- input path of RDF/XML or TTL filetdbDir
- location to put TDB mappings@Deprecated public static org.semanticweb.owlapi.model.OWLOntology convertModel(org.apache.jena.rdf.model.Model model) throws org.semanticweb.owlapi.model.OWLOntologyCreationException
convertModel(Model, IOHelper, String)
model
- Model to convert to OWLOntologyorg.semanticweb.owlapi.model.OWLOntologyCreationException
- on issue loading ontology from byte arraypublic static org.semanticweb.owlapi.model.OWLOntology convertModel(org.apache.jena.rdf.model.Model model, IOHelper ioHelper, String catalogPath) throws IOException
model
- Model to convert to OWLOntologyioHelper
- IOHelper to load ontologycatalogPath
- String path to XML catalogIOException
- on issue loading ontologypublic static int countResults(org.apache.jena.query.ResultSet results)
results
- The result set to count.public static org.apache.jena.query.Dataset createEmptyDataset()
@Deprecated public static org.apache.jena.rdf.model.Model execConstruct(org.apache.jena.sparql.core.DatasetGraph dsg, String query)
execConstruct(Dataset, String)
instead.dsg
- the graph to construct inquery
- the SPARQL construct query stringpublic static org.apache.jena.rdf.model.Model execConstruct(org.apache.jena.query.Dataset dataset, String query)
dataset
- the Dataset to construct inquery
- the SPARQL construct query string@Deprecated public static org.apache.jena.query.ResultSet execQuery(org.apache.jena.sparql.core.DatasetGraph dsg, String query) throws IOException
execQuery(Dataset, String)
instead.dsg
- the graph to queryquery
- the SPARQL query stringIOException
- on query parse errorpublic static org.apache.jena.query.ResultSet execQuery(org.apache.jena.query.Dataset dataset, String query) throws IOException
dataset
- the Dataset to query overquery
- the SPARQL query stringIOException
- on query parse errorpublic static void execUpdate(org.apache.jena.rdf.model.Model model, String updateString)
model
- Model to updateupdateString
- SPARQL update@Deprecated public static boolean execVerify(Map<File,Tuple<org.apache.jena.query.ResultSetRewindable,OutputStream>> queriesResults) throws IOException
queriesResults
- a map from files to query results and output streamsIOException
- on file issues@Deprecated public static boolean execVerify(org.apache.jena.sparql.core.DatasetGraph dsg, String ruleName, String query) throws IOException
execVerify(Dataset, String, String)
insteaddsg
- the graph to query overruleName
- name of rule to verifyquery
- the SPARQL query stringIOException
- on query parse errorpublic static boolean execVerify(org.apache.jena.query.Dataset dataset, String ruleName, String query) throws IOException
dataset
- Dataset to queryruleName
- name of rule to verifyquery
- the SPARQL query stringIOException
- on query parse errorpublic static String getDefaultFormatName(String query)
query
- the SPARQL query stringpublic static String getDefaultFormatName(org.apache.jena.query.Query query) throws IllegalArgumentException
query
- the SPARQL queryIllegalArgumentException
- on bad querypublic static org.apache.jena.riot.Lang getFormatLang(String formatName)
formatName
- the format name as a stringpublic static String getQueryTypeName(String queryString)
queryString
- the SPARQL query stringIllegalArgumentException
- on bad querypublic static boolean hasResult(org.apache.jena.query.ResultSet result)
result
- the results to writepublic static boolean hasResult(org.apache.jena.rdf.model.Model result)
result
- the results to writepublic static boolean maybeWriteResult(org.apache.jena.query.ResultSet result, String formatName, OutputStream output)
result
- the results to writeformatName
- the name of the language to write inoutput
- the output stream to write topublic static boolean maybeWriteResult(org.apache.jena.rdf.model.Model result, String formatName, OutputStream output)
result
- the Model to writeformatName
- the name of the language to write inoutput
- the output stream to write topublic static void runConstruct(org.apache.jena.query.Dataset dataset, String query, File output, org.apache.jena.riot.Lang outputFormat) throws FileNotFoundException
dataset
- the Dataset to construct in.query
- The SPARQL construct query string.output
- The file to write to.outputFormat
- The file format.FileNotFoundException
- if output file is not found@Deprecated public static void runQuery(org.apache.jena.sparql.core.DatasetGraph dsg, String query, File output, org.apache.jena.riot.Lang outputFormat) throws IOException
runQuery(Dataset, String, File, Lang)
instead.dsg
- the graph to queryquery
- The SPARQL query string.output
- The file to write to.outputFormat
- The file format.IOException
- if output file is not found or query cannot be parsedpublic static void runQuery(org.apache.jena.query.Dataset dataset, String query, File output, org.apache.jena.riot.Lang outputFormat) throws IOException
dataset
- The dataset to query over.query
- The SPARQL query string.output
- The file to write to.outputFormat
- The file format.IOException
- if output file is not found or query cannot be parsed@Deprecated public static boolean runSparqlQuery(org.apache.jena.sparql.core.DatasetGraph dsg, String query, String formatName, OutputStream output) throws IOException
runSparqlQuery(Dataset, String, String, OutputStream)
instead.dsg
- the graph to query overquery
- the SPARQL query stringformatName
- the name of the output formatoutput
- the OutputStream to write toIOException
- on issue parsing querypublic static boolean runSparqlQuery(org.apache.jena.query.Dataset dataset, String queryString, String formatName, OutputStream output) throws IOException
dataset
- Dataset to query overqueryString
- query to runformatName
- format of outputoutput
- output stream to write toIOException
- on issue parsing querypublic static boolean runSparqlQuery(org.apache.jena.query.QueryExecution qExec, String formatName, OutputStream output)
qExec
- QueryExecution to runformatName
- format of outputoutput
- output stream to write topublic static void runUpdate(org.apache.jena.rdf.model.Model model, String updateString, File output, org.apache.jena.riot.Lang outputFormat) throws FileNotFoundException
model
- Model to updateupdateString
- SPARQL updateoutput
- output stream to write tooutputFormat
- the file formatFileNotFoundException
- if output file cannot be found@Deprecated public static boolean runVerify(org.apache.jena.sparql.core.DatasetGraph dsg, String ruleName, String query, Path outputPath, org.apache.jena.riot.Lang outputFormat) throws IOException
runVerify(Dataset, String, String, Path, Lang)
instead.dsg
- The graph to query over.ruleName
- name of the rulequery
- The SPARQL query string.outputPath
- The file path to write to, if there are resultsoutputFormat
- The file format.IOException
- if output file is not found or query cannot be parsedpublic static boolean runVerify(org.apache.jena.query.Dataset dataset, String ruleName, String query, Path outputPath, org.apache.jena.riot.Lang outputFormat) throws IOException
dataset
- The dataset to query over.ruleName
- The name of the rule to verify.query
- The SPARQL query string.outputPath
- The file path to write to, if there are resultsoutputFormat
- The file format.IOException
- if output file is not found or query cannot be parsedpublic static void writeResult(boolean result, OutputStream output)
result
- the boolean to writeoutput
- the output stream to write topublic static void writeResult(org.apache.jena.query.ResultSet resultSet, String formatName, OutputStream output)
resultSet
- the results to writeformatName
- the name of the language to write inoutput
- the output stream to write topublic static void writeResult(org.apache.jena.query.ResultSet resultSet, org.apache.jena.riot.Lang format, OutputStream output)
resultSet
- the results to writeformat
- the language to write in (if null, CSV)output
- the output stream to write topublic static void writeResult(org.apache.jena.rdf.model.Model model, String formatName, OutputStream output)
model
- the Model to writeformatName
- the name of the language to write inoutput
- the output stream to write topublic static void writeResult(org.apache.jena.rdf.model.Model model, org.apache.jena.riot.Lang format, OutputStream output)
model
- the Model to writeformat
- the language to write in (if null, TTL)output
- the output stream to write toCopyright © 2015–2020. All rights reserved.