コード例 #1
0
        public override IEnumerable <Triple> WithPredicate(INode pred)
        {
            dotSesame.URI u = SesameConverter.ToSesameUri(pred, this._mapping);
            JavaIteratorWrapper <dotSesame.Statement> stmtIter = new JavaIteratorWrapper <org.openrdf.model.Statement>(this._g.match(null, u, null, null));

            return(stmtIter.Select(s => SesameConverter.FromSesame(s, this._mapping)));
        }
コード例 #2
0
        protected override org.openrdf.repository.RepositoryResult GetStatementsInternal(string sparqlQuery, SesameMapping mapping)
        {
            if (this._manager is IQueryableGenericIOManager)
            {
                try
                {
                    Object results = ((IQueryableGenericIOManager)this._manager).Query(sparqlQuery);
                    if (results is SparqlResultSet)
                    {
                        IEnumerable <dotSesame.Statement> stmts = from result in (SparqlResultSet)results
                                                                  select this._factory.createStatement(SesameConverter.ToSesameResource(result["subj"], mapping), SesameConverter.ToSesameUri(result["pred"], mapping), SesameConverter.ToSesameValue(result["obj"], mapping));

                        return(new dotSesameRepo.RepositoryResult(new DotNetAdunaIterationWrapper(stmts)));
                    }
                    else
                    {
                        throw new dotSesameRepo.RepositoryException("Unable to return Statements from this repository as the repository returned an unexpected result");
                    }
                }
                catch (Exception ex)
                {
                    throw new dotSesameRepo.RepositoryException("Unable to return Statements from this repository due to the following error: " + ex.Message);
                }
            }
            else
            {
                throw new dotSesameRepo.RepositoryException("This dotNetRDF Generic Repository does not support returning specific Statements");
            }
        }