I will build you a test case, but for now, those two classes amount to
10 calls to the following, where 'model' is the ontModel.

My premise was that this was a stupid mistake.

Actually, all this code is stuff I can share on github, come to think
it is, and it's quite small.

https://github.com/benson-basis/tdb-case ... but it wants a parent POM
that you won't have. Gimme a few minutes ...


        Individual entity = model.createIndividual(encodedUri("E",
item.getEntityId()), Res20140626.Entity);
        Individual document = model.createIndividual(encodedUri("D",
item.getDocId()), Res20140626.Document);
        // anonymous!
        Individual mention = model.createIndividual(Res20140626.Mention);
        if (item.getEntityId().startsWith("Q")) {
            model.createStatement(entity, OWL.sameAs,
String.format("http://www.wikidata.org/entity/%s";,
item.getEntityId()));
        }

        model.add(entity, Res20140626.hasEntityMention, mention);
        model.add(mention, Res20140626.hasMentionEntity, entity);
        model.add(mention, Res20140626.hasMentionDocument, document);
        model.add(document, Res20140626.hasDocumentMention, mention);
        if (typedLiterals) {
            model.add(entity, Skos.notation,
model.createTypedLiteral(item.getEntityId()));
            model.add(document, Skos.notation,
model.createTypedLiteral(item.getDocId()));
            model.add(mention, Res20140626.hasIndocId,
model.createTypedLiteral(item.getIndocId()));
            model.add(mention, Res20140626.hasMentionStart,
model.createTypedLiteral(item.getMentionStart()));
            model.add(mention, Res20140626.hasMentionEnd,
model.createTypedLiteral(item.getMentionEnd()));
            model.add(mention, Res20140626.hasMentionText,
model.createTypedLiteral(item.getMentionText()));
            model.add(mention, Res20140626.hasConfidence,
model.createTypedLiteral(item.getConfidence()));
        } else {
            model.add(entity, Skos.notation,
model.createLiteral(item.getEntityId()));
            model.add(document, Skos.notation,
model.createLiteral(item.getDocId()));
            model.add(mention, Res20140626.hasIndocId,
model.createLiteral(item.getIndocId()));
            model.add(mention, Res20140626.hasMentionStart,
model.createLiteral(Integer.toString(item.getMentionStart())));
            model.add(mention, Res20140626.hasMentionEnd,
model.createLiteral(Integer.toString(item.getMentionEnd())));
            model.add(mention, Res20140626.hasMentionText,
model.createLiteral(item.getMentionText()));
            model.add(mention, Res20140626.hasConfidence,
model.createLiteral(Double.toString(item.getConfidence())));
        }

On Sun, Jun 29, 2014 at 6:20 AM, Andy Seaborne <[email protected]> wrote:
> On 27/06/14 14:25, Benson Margulies wrote:
>>
>> here's a little test method. The second call to smallAssertions sees
>> no triples at all. There's a todo on the doc for ontologies, and I'll
>> cheerfully write some doc if someone will tell me what dumb thing I've
>> missed here.
>>
>>
>
> Hi Benson,
>
> There seem to be details that might matter but aren't included.  Do you have
> a complete, standalone, test case?
>
>
>>   @Test
>>      public void tdb() throws Exception {
>>          Dataset dataset =
>> TDBFactory.createDataset(tempDataset.getAbsolutePath());
>>          dataset.begin(ReadWrite.WRITE);
>>          Model model = dataset.getDefaultModel();
>>          OntModel ontModel =
>> ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, model);
>>          ResRdfBuilder resRdfBuilder = new ResRdfBuilder(ontModel, 1);
>>          ResTsvReader reader = new ResTsvReader();
>>          URL dataUrl = Resources.getResource(ResTsvReaderTest.class,
>> "data.txt");
>>          ByteSource dataSource = Resources.asByteSource(dataUrl);
>>          reader.read(dataSource, resRdfBuilder);
>
>
> ResRdfBuilder and ResTsvReader.read -- what do they do?
>
>
>>          smallAssertions(ontModel);
>>          dataset.end();
>>
>>          dataset.begin(ReadWrite.READ);
>>          model = dataset.getDefaultModel();
>>          smallAssertions(model);
>>          dataset.end();
>>      }
>>
>
>         Andy
>

Reply via email to