Ejemplo n.º 1
0
 /// <summary>
 /// Converts a dotNetRDF Graph to a Sesame Graph
 /// </summary>
 /// <param name="g">dotNetRDF Graph</param>
 /// <param name="mapping">Blank Node Mapping</param>
 /// <param name="target">Sesame Graph</param>
 public static void ToSesame(IGraph g, SesameMapping mapping, dotSesame.Graph target)
 {
     foreach (Triple t in g.Triples)
     {
         target.add(ToSesameResource(t.Subject, mapping), ToSesameUri(t.Predicate, mapping), ToSesameValue(t.Object, mapping));
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Converts a Sesame Graph to a dotNetRDF Graph
        /// </summary>
        /// <param name="source">Sesame Graph</param>
        /// <param name="mapping">Blank Node Mapping</param>
        /// <param name="target">dotNetRDF Graph</param>
        public static void FromSesame(dotSesame.Graph source, SesameMapping mapping, IGraph target)
        {
            Iterator iter = source.iterator();

            while (iter.hasNext())
            {
                dotSesame.Statement stmt = (dotSesame.Statement)iter.next();
                target.Assert(FromSesame(stmt, mapping));
            }
        }
Ejemplo n.º 3
0
        public org.openrdf.model.Resource export(org.openrdf.model.Graph g)
        {
            SesameGraph temp = new SesameGraph(g);

            if (this._repo is IConfigurationSerializable)
            {
                IUriNode subj = temp.CreateUriNode(new Uri("dotnetrdf:interop:sesame:repository:" + this._name));
                ConfigurationSerializationContext context = new ConfigurationSerializationContext(temp);
                context.NextSubject = subj;
                ((IConfigurationSerializable)this._repo).SerializeConfiguration(context);
                return(g.getValueFactory().createURI(subj.ToString()));
            }
            else
            {
                throw new NotSupportedException("The underlying Repository does not support having it's Configuration serialized");
            }
        }
Ejemplo n.º 4
0
        public void parse(org.openrdf.model.Graph g, org.openrdf.model.Resource r)
        {
            Graph         config  = new Graph();
            SesameMapping mapping = new SesameMapping(config, g);

            SesameConverter.FromSesame(g, config);

            this._name = r.stringValue().Substring(r.stringValue().LastIndexOf(":") + 1);

            Object temp = ConfigurationLoader.LoadObject(config, SesameConverter.FromSesameResource(r, mapping));

            if (temp is IInMemoryQueryableStore)
            {
                this._repo = new DotNetRdfInMemoryRepository((IInMemoryQueryableStore)temp);
            }
            else if (temp is IGenericIOManager)
            {
                this._repo = new DotNetRdfGenericRepository((IGenericIOManager)temp);
            }
            else
            {
                throw new dotSesameRepo.config.RepositoryConfigException("Unable to load Configuration for the Repository as the loaded Object was not an IInMemoryQueryableStore or an IGenericIOManager implementation");
            }
        }
Ejemplo n.º 5
0
 public SesameGraph(dotSesame.Graph g)
 {
     this._g = g;
     this._mapping = new SesameMapping(this, this._g);
     this._triples = new SesameTripleCollection(this._g, this._mapping);
 }
Ejemplo n.º 6
0
 public SesameMapping(DotNetRdfValueFactory factory, dotSesame.Graph target)
 {
     this._g       = factory.Graph;
     this._target  = target;
     this._factory = factory;
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Creates a new Sesame mapping
 /// </summary>
 /// <param name="g">Graph</param>
 public SesameMapping(IGraph g, dotSesame.Graph target)
 {
     this._g      = g;
     this._target = target;
 }
Ejemplo n.º 8
0
 public SesameGraph(dotSesame.Graph g)
 {
     this._g       = g;
     this._mapping = new SesameMapping(this, this._g);
     this._triples = new SesameTripleCollection(this._g, this._mapping);
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Converts a dotNetRDF Graph to a Sesame Graph
        /// </summary>
        /// <param name="g">dotNetRDF Graph</param>
        /// <param name="target">Sesame Graph</param>
        public static void ToSesame(IGraph g, dotSesame.Graph target)
        {
            SesameMapping mapping = new SesameMapping(g, target);

            ToSesame(g, mapping, target);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Converts a Sesame Graph to a dotNetRDF Graph
        /// </summary>
        /// <param name="source">Sesame Graph</param>
        /// <param name="target">dotNetRDF Graph</param>
        public static void FromSesame(dotSesame.Graph source, IGraph target)
        {
            SesameMapping mapping = new SesameMapping(target, source);

            FromSesame(source, mapping, target);
        }
 public SesameTripleCollection(dotSesame.Graph g, SesameMapping mapping)
 {
     this._g = g;
     this._mapping = mapping;
 }
Ejemplo n.º 12
0
 public SesameTripleCollection(dotSesame.Graph g, SesameMapping mapping)
 {
     this._g       = g;
     this._mapping = mapping;
 }
Ejemplo n.º 13
0
 public SesameMapping(DotNetRdfValueFactory factory, dotSesame.Graph target)
 {
     this._g = factory.Graph;
     this._target = target;
     this._factory = factory;
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Creates a new Sesame mapping
 /// </summary>
 /// <param name="g">Graph</param>
 public SesameMapping(IGraph g, dotSesame.Graph target)
 {
     this._g = g;
     this._target = target;
 }
Ejemplo n.º 15
0
 public DotNetRdfValueFactory(IGraph g, dotSesame.Graph target)
     : this(new SesameMapping(g, target))
 {
 }