public class SPARQLBasedRDFTripleModelImpl extends BaseRDFModelImpl implements BaseRDFTripleModel
Modifier and Type | Class and Description |
---|---|
class |
SPARQLBasedRDFTripleModelImpl.StatementAfterTupleBindings
wraps a
TupleBindings object the content of which is composed of a |
class |
SPARQLBasedRDFTripleModelImpl.StatementIteratorAfterTupleBindingsIterator
wraps a
TupleBindingsIterator the content of which is composed of |
baseRep
Constructor and Description |
---|
SPARQLBasedRDFTripleModelImpl(TripleQueryModelHTTPConnection tqModel) |
Modifier and Type | Method and Description |
---|---|
void |
addRDF(File inputFile,
String baseURI,
RDFFormat rdfFormat,
ARTResource... graphs)
adds RDF data to graphs
graphs by loading it from inputfile inputFile . |
void |
addRDF(URL url,
String baseURI,
RDFFormat rdfFormat,
ARTResource... graphs)
adds RDF data to graphs
graphs by loading it from url url . |
void |
addStatement(ARTStatement stat,
ARTResource... graphs)
add statement
stat to graphs graphs |
void |
addTriple(ARTResource subject,
ARTURIResource predicate,
ARTNode object,
ARTResource... graphs)
adds the specified triple to graphs
graphs |
void |
clearRDF(ARTResource... graphs)
completely clears any RDF statement from the specified graphs
|
void |
close()
closes the current model, releasing its resources
|
ARTBNode |
createBNode()
this method just generates a POJO wrapping a blank node for the ontology.
|
ARTBNode |
createBNode(String ID)
this method just generates a POJO wrapping a blank node for the ontology.
|
BooleanQuery |
createBooleanQuery(QueryLanguage ql,
String query,
String baseURI)
creates a boolean query.
|
GraphQuery |
createGraphQuery(QueryLanguage ql,
String query,
String baseURI)
creates a graph query.
|
ARTLiteral |
createLiteral(String literalString)
creates a literal from its string representation
|
ARTLiteral |
createLiteral(String literalString,
ARTURIResource datatype)
composes an creates a literal with a given datatype
|
ARTLiteral |
createLiteral(String literalString,
String language)
composes and creates a literal starting from its base label and the assigned language
|
Query |
createQuery(QueryLanguage ql,
String query,
String baseURI)
creates a generic query.
|
ARTStatement |
createStatement(ARTResource subject,
ARTURIResource predicate,
ARTNode object)
this method just generates a POJO wrapping a statement for the ontology.
|
TupleQuery |
createTupleQuery(QueryLanguage ql,
String query,
String baseURI)
creates a tuple query.
|
Update |
createUpdate(QueryLanguage ql,
String query,
String baseURI)
creates an update query.
|
ARTURIResource |
createURIResource(String uri)
this method just generates a POJO wrapping an URI for the ontology.
|
void |
deleteStatement(ARTStatement statement,
ARTResource... graphs)
deletes the specified statement from graphs
graphs |
void |
deleteTriple(ARTResource subject,
ARTURIResource property,
ARTNode object,
ARTResource... graphs)
deletes the triple identified by <
subject , property , object
> from the specified graphs |
String |
expandQName(String qname)
Expand a qname into an uri using the prefix mappings, if a prefix is available.
|
String |
getBaseURI()
returns the baseuri of the ontology managed by this model
|
String |
getDefaultNamespace()
returns the default namespace of the ontology managed by this model
|
Map<String,String> |
getNamespacePrefixMapping()
Return a copy of the internal mapping from prefixes to namespaces (as strings).
|
String |
getNSForPrefix(String prefix)
Gets the URI bound to a specific prefix, null if there isn't one.
|
String |
getPrefixForNS(String namespace)
Answer the prefix for the given URI, or null if there isn't one.
|
String |
getQName(String uri)
Compress the URI into a qname using the prefix mappings, if a prefix is available.
|
boolean |
hasStatement(ARTStatement stat,
boolean inferred,
ARTResource... graphs)
checks that the specified statement is present in this model, inside one of the graphs specified in
graphs |
boolean |
hasTriple(ARTResource subj,
ARTURIResource pred,
ARTNode obj,
boolean inferred,
ARTResource... graphs)
checks that the triple identified by <
subj , pred , obj > is
present in this model, inside one of the graphs specified in graphs |
ARTResourceIterator |
listNamedGraphs()
returns an
ARTResourceIterator over the namedgraphs declared in the global RDF graph |
ARTNamespaceIterator |
listNamespaces()
list all namespaces used in this model
|
ARTStatementIterator |
listStatements(ARTResource subj,
ARTURIResource pred,
ARTNode obj,
boolean inferred,
ARTResource... graphs)
returns statements which unify with triples containing
subj , pred and
obj in their respective positions. |
void |
removeNsPrefixMapping(String namespace)
Removes prefix/namespace mapping
|
void |
setBaseURI(String uri)
sets the baseuri for the ontology managed by this model
|
void |
setDefaultNamespace(String namespace)
sets the default namespace for the ontology managed by this model
|
void |
setNsPrefix(String namespace,
String prefix)
Specify the prefix name for a URI prefix string.
|
void |
writeRDF(File outputFile,
RDFFormat rdfFormat,
ARTResource... graphs)
writes RDF data from graphs
graphs into file outputFile . |
void |
writeRDF(OutputStream os,
RDFFormat rdfFormat,
ARTResource... graphs)
writes RDF data from graphs
graphs to output stream os . |
void |
writeRDF(RDFIterator<ARTStatement> it,
RDFFormat format,
OutputStream out)
writes an RDFIterator of statements to output stream and then closes it.
|
void |
writeRDF(RDFIterator<ARTStatement> it,
RDFFormat format,
Writer wout)
manages an RDFIterator of statements to be serialized according to the specified format, and passes it
to the chosen writer.
|
listPredicatesOfSubjObjPair, listSubjectsOfPredObjPair, listValuesOfSubjPredPair
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
listPredicatesOfSubjObjPair, listSubjectsOfPredObjPair, listValuesOfSubjPredPair
public SPARQLBasedRDFTripleModelImpl(TripleQueryModelHTTPConnection tqModel)
public Query createQuery(QueryLanguage ql, String query, String baseURI) throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException
TripleQueryModel
query
)createQuery
in interface TripleQueryModel
ql
- the query languagequery
- the text content of the querybaseURI
- the baseuri to be considered for relative resources' names in the given queryUnsupportedQueryLanguageException
ModelAccessException
MalformedQueryException
public BooleanQuery createBooleanQuery(QueryLanguage ql, String query, String baseURI) throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException
TripleQueryModel
createBooleanQuery
in interface TripleQueryModel
ql
- the query languagequery
- the text content of the querybaseURI
- the baseuri to be considered for relative resources' names in the given queryUnsupportedQueryLanguageException
ModelAccessException
MalformedQueryException
public GraphQuery createGraphQuery(QueryLanguage ql, String query, String baseURI) throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException
TripleQueryModel
createGraphQuery
in interface TripleQueryModel
ql
- the query languagequery
- the text content of the querybaseURI
- the baseuri to be considered for relative resources' names in the given queryUnsupportedQueryLanguageException
ModelAccessException
MalformedQueryException
public TupleQuery createTupleQuery(QueryLanguage ql, String query, String baseURI) throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException
TripleQueryModel
createTupleQuery
in interface TripleQueryModel
ql
- the query languagequery
- the text content of the querybaseURI
- the baseuri to be considered for relative resources' names in the given queryUnsupportedQueryLanguageException
ModelAccessException
MalformedQueryException
public void addTriple(ARTResource subject, ARTURIResource predicate, ARTNode object, ARTResource... graphs) throws ModelUpdateException
BaseRDFTripleModel
graphs
addTriple
in interface BaseRDFTripleModel
ModelUpdateException
public void addStatement(ARTStatement stat, ARTResource... graphs) throws ModelUpdateException
BaseRDFTripleModel
stat
to graphs graphs
addStatement
in interface BaseRDFTripleModel
ModelUpdateException
public void deleteTriple(ARTResource subject, ARTURIResource property, ARTNode object, ARTResource... graphs) throws ModelUpdateException
BaseRDFTripleModel
subject
, property
, object
> from the specified graphs
deleteTriple
in interface BaseRDFTripleModel
ModelUpdateException
public void deleteStatement(ARTStatement statement, ARTResource... graphs) throws ModelUpdateException
BaseRDFTripleModel
graphs
deleteStatement
in interface BaseRDFTripleModel
ModelUpdateException
public void clearRDF(ARTResource... graphs) throws ModelUpdateException
BaseRDFTripleModel
clearRDF
in interface BaseRDFTripleModel
ModelUpdateException
public void addRDF(File inputFile, String baseURI, RDFFormat rdfFormat, ARTResource... graphs) throws FileNotFoundException, IOException, ModelAccessException, ModelUpdateException, UnsupportedRDFFormatException
BaseRDFTripleModel
graphs
by loading it from inputfile inputFile
. Data
in the file must be formatted according to the specified rdfFormat
. The specified
baseURI
is used for those formats where relative resource names are present and the
baseuri is not present in the file.addRDF
in interface BaseRDFTripleModel
FileNotFoundException
IOException
ModelAccessException
ModelUpdateException
UnsupportedRDFFormatException
public void addRDF(URL url, String baseURI, RDFFormat rdfFormat, ARTResource... graphs) throws FileNotFoundException, IOException, ModelAccessException, ModelUpdateException, UnsupportedRDFFormatException
BaseRDFTripleModel
graphs
by loading it from url url
. Data in the file
must be formatted according to the specified rdfFormat
. The specified baseURI
is used for those formats where relative resource names are present and the baseuri is not present in
the file.RDFFormat.getMIMEType()
method.addRDF
in interface BaseRDFTripleModel
rdfFormat
- if null
, then content format sent must be inferred from the server responseFileNotFoundException
IOException
ModelAccessException
ModelUpdateException
UnsupportedRDFFormatException
public void writeRDF(File outputFile, RDFFormat rdfFormat, ARTResource... graphs) throws IOException, ModelAccessException, UnsupportedRDFFormatException
BaseRDFTripleModel
graphs
into file outputFile
. Data in the file
will be formatted according to the specified rdfFormat
.writeRDF
in interface BaseRDFTripleModel
IOException
ModelAccessException
UnsupportedRDFFormatException
public void writeRDF(OutputStream os, RDFFormat rdfFormat, ARTResource... graphs) throws IOException, ModelAccessException, UnsupportedRDFFormatException
BaseRDFTripleModel
graphs
to output stream os
. Data in the file will
be formatted according to the specified rdfFormat
.writeRDF
in interface BaseRDFTripleModel
IOException
ModelAccessException
UnsupportedRDFFormatException
public void writeRDF(RDFIterator<ARTStatement> it, RDFFormat format, OutputStream out) throws ModelAccessException, UnsupportedRDFFormatException, IOException
RDFSerializer
writeRDF
in interface RDFSerializer
ModelAccessException
UnsupportedRDFFormatException
IOException
public void writeRDF(RDFIterator<ARTStatement> it, RDFFormat format, Writer wout) throws ModelAccessException, UnsupportedRDFFormatException, IOException
RDFSerializer
writeRDF
in interface RDFSerializer
ModelAccessException
UnsupportedRDFFormatException
IOException
public ARTNamespaceIterator listNamespaces() throws ModelAccessException
BaseRDFTripleModel
listNamespaces
in interface BaseRDFTripleModel
ModelAccessException
public ARTResourceIterator listNamedGraphs() throws ModelAccessException
BaseRDFTripleModel
ARTResourceIterator
over the namedgraphs declared in the global RDF graphlistNamedGraphs
in interface BaseRDFTripleModel
ModelAccessException
public boolean hasTriple(ARTResource subj, ARTURIResource pred, ARTNode obj, boolean inferred, ARTResource... graphs) throws ModelAccessException
BaseRDFTripleModel
subj
, pred
, obj
> is
present in this model, inside one of the graphs specified in graphs
hasTriple
in interface BaseRDFTripleModel
subj
- the subject of the triplepred
- the predicate of the tripleobj
- the object of the tripleinferred
- tells if the inference engine of the model is to be used for this retrieval operationgraphs
- the graphs where to look for the specified tripleModelAccessException
public boolean hasStatement(ARTStatement stat, boolean inferred, ARTResource... graphs) throws ModelAccessException
BaseRDFTripleModel
graphs
hasStatement
in interface BaseRDFTripleModel
stat
- the statement which is checked inside the modelinferred
- tells if the inference engine of the model is to be used for this retrieval operationgraphs
- the graphs where to look for the specified statementModelAccessException
public ARTStatementIterator listStatements(ARTResource subj, ARTURIResource pred, ARTNode obj, boolean inferred, ARTResource... graphs) throws ModelAccessException
BaseRDFTripleModel
subj
, pred
and
obj
in their respective positions. A NodeFilters.ANY
value in one of these
positions is equivalent to putting a wildcard in that position.listStatements
in interface BaseRDFTripleModel
subj
- the subject of the triplepred
- the predicate of the tripleobj
- the object of the tripleModelAccessException
public void close() throws ModelUpdateException
BaseRDFTripleModel
close
in interface BaseRDFTripleModel
ModelUpdateException
public void setDefaultNamespace(String namespace) throws ModelUpdateException
BaseRDFTripleModel
setDefaultNamespace
in interface BaseRDFTripleModel
ModelUpdateException
public void setBaseURI(String uri) throws ModelUpdateException
BaseRDFTripleModel
setBaseURI
in interface BaseRDFTripleModel
ModelUpdateException
public String getDefaultNamespace()
BaseRDFTripleModel
getDefaultNamespace
in interface BaseRDFTripleModel
public String getBaseURI()
BaseRDFTripleModel
getBaseURI
in interface BaseRDFTripleModel
public ARTLiteral createLiteral(String literalString)
ARTNodeFactory
createLiteral
in interface ARTNodeFactory
public ARTLiteral createLiteral(String literalString, String language)
ARTNodeFactory
createLiteral
in interface ARTNodeFactory
public ARTLiteral createLiteral(String literalString, ARTURIResource datatype)
ARTNodeFactory
createLiteral
in interface ARTNodeFactory
public ARTURIResource createURIResource(String uri)
ARTNodeFactory
createURIResource
in interface ARTNodeFactory
public ARTBNode createBNode()
ARTNodeFactory
createBNode
in interface ARTNodeFactory
public ARTBNode createBNode(String ID)
ARTNodeFactory
createBNode
in interface ARTNodeFactory
ID
- an internal identifier which can be used to retrieve the blank node, if knownpublic ARTStatement createStatement(ARTResource subject, ARTURIResource predicate, ARTNode object)
ARTNodeFactory
createStatement
in interface ARTNodeFactory
public String expandQName(String qname) throws ModelAccessException
PrefixMapping
expandQName
in interface PrefixMapping
ModelAccessException
public String getQName(String uri) throws ModelAccessException
PrefixMapping
getQName
in interface PrefixMapping
ModelAccessException
public Map<String,String> getNamespacePrefixMapping() throws ModelAccessException
PrefixMapping
getNamespacePrefixMapping
in interface PrefixMapping
ModelAccessException
public String getNSForPrefix(String prefix) throws ModelAccessException
PrefixMapping
getNSForPrefix
in interface PrefixMapping
ModelAccessException
public String getPrefixForNS(String namespace) throws ModelAccessException
PrefixMapping
getPrefixForNS
in interface PrefixMapping
ModelAccessException
public void setNsPrefix(String namespace, String prefix) throws ModelUpdateException
PrefixMapping
setNsPrefix
in interface PrefixMapping
ModelUpdateException
public void removeNsPrefixMapping(String namespace) throws ModelUpdateException
PrefixMapping
removeNsPrefixMapping
in interface PrefixMapping
ModelUpdateException
public Update createUpdate(QueryLanguage ql, String query, String baseURI) throws UnsupportedQueryLanguageException, ModelAccessException, MalformedQueryException
TripleQueryModel
createUpdate
in interface TripleQueryModel
ql
- the query languagequery
- the text content of the querybaseURI
- the baseuri to be considered for relative resources' names in the given queryUnsupportedQueryLanguageException
ModelAccessException
MalformedQueryException
Copyright © 2015 ART Group, University of Rome, Tor Vergata. All Rights Reserved.