[ https://issues.apache.org/jira/browse/RYA-541?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonas Halvorsen updated RYA-541: -------------------------------- Description: Given an updated RDF4j (e.g. the pull of <[https://github.com/apache/rya/pull/315]>, but ideally newer), importing RDF-star, and querying using SPARQL-star pattern notation e.g. "<<?s ?p ?o>> ?a." where the variables bind to terms of type IRI U BNode U Literal should more or less work out of the box I believe. It should only require small changes to the addStatementInternal-method in RdfCloudTripleStoreConnection-class to be able to store (and query) RDF-star data in Rya. That is, there are helper functions in RDF4j that convert RDF-star statements to reified RDF, for storage in a regular RDF store. Additionally, there are functions that encode the "blank" nodes that are created during this task using special IRIs that the SPARQL-star evaluator in RDF4j can utilize in order to identify RDF-star-encoded-as-Reification during evaluation. Since RYA extends RDF4j's evaluation strategy, query evaluation seems to work without adding new code. The following code should be sufficient (incorporate into addStatementInternal-method in RdfCloudTripleStoreConnection-class): \\* Statement stmt = SimpleValueFactory.getInstance().createStatement(subject, predicate, object, context); Statements.convertRDFStarToReification(stmt, list::add); List<RyaStatement> ryaStatements = list.stream().map(x -> new RyaStatement( RdfToRyaConversions.convertResource(RDFStarUtil.toRDFEncodedValue(x.getSubject())), RdfToRyaConversions.convertIRI(x.getPredicate()), RdfToRyaConversions.convertValue(RDFStarUtil.toRDFEncodedValue(x.getObject())), RdfToRyaConversions.convertResource(context), null, new StatementMetadata(),cv)).collect(Collectors.toList()); *\ Now, this works when querying using SPARQL-star patterns where variables do not bind to triples (that is, the result set is a standard SPARQL result set). Producing SPARQL-star result sets on the other hand where the variable to could bind to a Triple (e.g. "?s ?p ?o", where ?s could bind to a Triple of type "<<:john :knows :jack") seems to require some more work. was: Given an updated RDF4j (e.g. the pull of <[https://github.com/apache/rya/pull/315]>, but ideally newer), importing RDF-star, and querying using SPARQL-star pattern notation e.g. "<<?s ?p ?o>> ?a." where the variables bind to terms of type IRI U BNode U Literal should more or less work out of the box I believe. It should only require small changes to the addStatementInternal-method in RdfCloudTripleStoreConnection-class to be able to store (and query) RDF-star data in Rya. That is, there are helper functions in RDF4j that convert RDF-star statements to reified RDF, for storage in a regular RDF store. Additionally, there are functions that encode the "blank" nodes that are created during this task using special IRIs that the SPARQL-star evaluator in RDF4j can utilize in order to identify RDF-star-encoded-as-Reification during evaluation. Since RYA extends RDF4j's evaluation strategy, query evaluation seems to work without adding new code. The following code should be sufficient (incorporate into addStatementInternal-method in RdfCloudTripleStoreConnection-class): \* Statement stmt = SimpleValueFactory.getInstance().createStatement(subject, predicate, object, context); Statements.convertRDFStarToReification(stmt, list::add); List<RyaStatement> ryaStatements = list.stream().map(x -> new RyaStatement( RdfToRyaConversions.convertResource(RDFStarUtil.toRDFEncodedValue(x.getSubject())), RdfToRyaConversions.convertIRI(x.getPredicate()), RdfToRyaConversions.convertValue(RDFStarUtil.toRDFEncodedValue(x.getObject())), RdfToRyaConversions.convertResource(context), null, new StatementMetadata(),cv)).collect(Collectors.toList()); *\ Now, this works when querying using SPARQL-star patterns where variables do not bind to triples (that is, the result set is a standard SPARQL result set). Producing SPARQL-star result sets on the other hand where the variable to could bind to a Triple (e.g. "?s ?p ?o", where ?s could bind to a Triple of type "<<:john :knows :jack") seems to require some more work. > Add RDF-star/SPARQL-star support to RYA > --------------------------------------- > > Key: RYA-541 > URL: https://issues.apache.org/jira/browse/RYA-541 > Project: Rya > Issue Type: Improvement > Reporter: Jonas Halvorsen > Priority: Major > > Given an updated RDF4j (e.g. the pull of > <[https://github.com/apache/rya/pull/315]>, but ideally newer), importing > RDF-star, and querying using SPARQL-star pattern notation e.g. "<<?s ?p ?o>> > ?a." where the variables bind to terms of type IRI U BNode U Literal should > more or less work out of the box I believe. It should only require small > changes to the addStatementInternal-method in > RdfCloudTripleStoreConnection-class to be able to store (and query) RDF-star > data in Rya. > > That is, there are helper functions in RDF4j that convert RDF-star statements > to reified RDF, for storage in a regular RDF store. Additionally, there are > functions that encode the "blank" nodes that are created during this task > using special IRIs that the SPARQL-star evaluator in RDF4j can utilize in > order to identify RDF-star-encoded-as-Reification during evaluation. Since > RYA extends RDF4j's evaluation strategy, query evaluation seems to work > without adding new code. > > The following code should be sufficient (incorporate into > addStatementInternal-method in RdfCloudTripleStoreConnection-class): > \\* > Statement stmt = SimpleValueFactory.getInstance().createStatement(subject, > predicate, object, context); > Statements.convertRDFStarToReification(stmt, list::add); > List<RyaStatement> ryaStatements = list.stream().map(x -> new RyaStatement( > > RdfToRyaConversions.convertResource(RDFStarUtil.toRDFEncodedValue(x.getSubject())), > RdfToRyaConversions.convertIRI(x.getPredicate()), > RdfToRyaConversions.convertValue(RDFStarUtil.toRDFEncodedValue(x.getObject())), > RdfToRyaConversions.convertResource(context), null, new > StatementMetadata(),cv)).collect(Collectors.toList()); > *\ > > Now, this works when querying using SPARQL-star patterns where variables do > not bind to triples (that is, the result set is a standard SPARQL result > set). Producing SPARQL-star result sets on the other hand where the variable > to could bind to a Triple (e.g. "?s ?p ?o", where ?s could bind to a Triple > of type "<<:john :knows :jack") seems to require some more work. > -- This message was sent by Atlassian Jira (v8.20.10#820010)