Hi

When I try to save my propertytabelgraph in a TDB dataset then I get
a org.apache.jena.shared.AddDeniedException exception.

This exception is thrown by the GraphBase class:

/**
  Add a triple to the triple store. The default implementation throws an
  AddDeniedException; subclasses must override if they want to be able to
  add triples.
*/
@Override
public void performAdd( Triple t )
    { throw new AddDeniedException( "GraphBase::performAdd" ); }

This function is called because I create a GraphPropertyTable which inherit
from GraphBase but does not overwrite the perfromAdd method.

I am unsure on how I should proceed now. Either I am doing something wrong,
or then I need to implement the performAdd method!

Here is a minimum example that recreate the problem:

PropertyTable propertytable = new PropertyTableArrayImpl(2, 2);
Column alpha =
propertytable.createColumn(NodeFactory.createLiteral("alpha"));
Column beta =
propertytable.createColumn(NodeFactory.createLiteral("beta"));
Row one = propertytable.createRow(NodeFactory.createLiteral("one"));
Row two = propertytable.createRow(NodeFactory.createLiteral("two"));

propertytable.getRow(one.getRowKey()).setValue(alpha,NodeFactory.createLiteral("alpha-one"));
propertytable.getRow(one.getRowKey()).setValue(beta,NodeFactory.createLiteral("beta-two"));
propertytable.getRow(two.getRowKey()).setValue(alpha,NodeFactory.createLiteral("alpha-one"));
propertytable.getRow(two.getRowKey()).setValue(beta,NodeFactory.createLiteral("beta-two"));

GraphPropertyTable graph = new GraphPropertyTable(propertytable);
Model model = ModelFactory.createModelForGraph(graph); Dataset dataset =
TDBFactory.createDataset("tdb/");
dataset.begin(ReadWrite.WRITE);
try {
    dataset.addNamedModel("www.example.org/model", model);
    dataset.commit();
} finally {
    dataset.end();
}

How do I proceed in order to persist my property table on disk?

On Thu, 27 Aug 2015 at 11:56 Andy Seaborne <[email protected]> wrote:

> On 27/08/15 07:16, Kim A. Jakobsen wrote:
> > On Wed, 26 Aug 2015 at 21:15 Andy Seaborne <[email protected]> wrote:
> >
> >> On 26/08/15 10:24, Kim A. Jakobsen wrote:
> >>> Hi
> >>>
> >>> I have created a property table and I would like to query it using
> >> SPARQL.
> >>> My code looks as follows:
> >>>
> >>> PropertyTable propertytable = new PropertyTableArrayImpl(1, 1);
> >>> Column something = propertytable.createColumn(NodeFactory.createURI("
> >>> http://example.org/"; + "something"));
> >>> Row row = propertytable.createRow(NodeFactory.createURI("
> >> http://example.org/";
> >>> + "apple"));
> >>> row.setValue(something, NodeFactory.createLiteral("JOHN"));
> >>>
> >>> How do I query the property table?
> >>
> >> Hi there,
> >>
> >> You can make the property table appear as an RDF graph with
> >>
> >> GraphPropertyTable
> >>
> >> and make that a model
> >>
> >> ModelFactory.createModelForGraph
> >> if you want to.
> >>
> >> You can query it with SPARQL or the RDF API.
> >>
> >>          Andy
> >>
> >>>
> >>> Additionally then I would also like to make my property table
> persistent,
> >>> i.e. save it to the disk.
> >>> As fare as I know then it is only possible to save it as a CSV file, is
> >>> there any other options?
> >>
> >> You can write the RDF graph.
> >>
> >   I suspect that if I simply write the model to the disk it will save it
> in
> > a statement table and not in a property table, how does it actually work?
>
> It will be an RDF graph - not a CSV file.  I was assuming you want to
> work with CSV data as RDF but it sounds like you have a different
> objective.
>
> > I would like to play around with different indexes for the property table
> > but I do not know how much is implemented in Jena already.
>
> You'll have to look in the code for that.  It's all in the jena-csv module.
>
>         Andy
>
> >
> > Thanks
> > Kim
> >
> > In fact, what might work for you is to convert the CSV file with
> >> riotcmdx.csv2rdf and work in RDF from there on.
> >>
> >>          Andy
> >
> >>
> >>> Regards
> >>> Kim A. Jakobsen
> >>>
> >>
> >>
> >
>
>

Reply via email to