Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

harry-6
I'm looking for a javascript (js) implementation which does this:

- storing RDF datasource as .js file instead of .rdf like

     Assert(sv, {pv1:xx, pv2:xy, ...})
     UnAssert(sv, {pv1:xx, pv2:xy, ...})

   where Assert and UnAssert are functions in a sandbox (or eval),
   doing asserts or unasserts:
      sv pv1 xx
      sv pv2 xy

- append lines to the .js for additional asserts/unasserts (using toSource)

- allow full rewrite of js (maybe on Flush)

looking for approbiate js-source of a class that implements
nsIRDFDataSource and nsIRDFRemoteDataSource (like nsLDAPDataSource)

Anyone did this before?

Harry
PS: sorry for crossposting
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

Axel Hecht-2
Harry wrote:

> I'm looking for a javascript (js) implementation which does this:
>
> - storing RDF datasource as .js file instead of .rdf like
>
>     Assert(sv, {pv1:xx, pv2:xy, ...})
>     UnAssert(sv, {pv1:xx, pv2:xy, ...})
>
>   where Assert and UnAssert are functions in a sandbox (or eval),
>   doing asserts or unasserts:
>      sv pv1 xx
>      sv pv2 xy
>
> - append lines to the .js for additional asserts/unasserts (using toSource)
>
> - allow full rewrite of js (maybe on Flush)
>
> looking for approbiate js-source of a class that implements
> nsIRDFDataSource and nsIRDFRemoteDataSource (like nsLDAPDataSource)
>
> Anyone did this before?
>

Your model may be ok for your DS, but in general, it won't work, as
there can be more than one arc with the same source and predicates,
which js objects don't support.

I wouldn't know how to represent resource targets in arcs, either.
Unless xx and xy would be nsIRDFNode objects, but that of course doesn't
serialize per se.

There is no systematical problem with creating a rdfds impl in js, you
just have to, like with a C++ impl, play nice with the RDF Service.

Axel
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

harry-6
Axel Hecht wrote:

> Harry wrote:
>> I'm looking for a javascript (js) implementation which does this:
>>
>> - storing RDF datasource as .js file instead of .rdf like
>>
>>     Assert(sv, {pv1:xx, pv2:xy, ...})
>>     UnAssert(sv, {pv1:xx, pv2:xy, ...})
>>
>>   where Assert and UnAssert are functions in a sandbox (or eval),
>>   doing asserts or unasserts:
>>      sv pv1 xx
>>      sv pv2 xy
>>
>> - append lines to the .js for additional asserts/unasserts (using
>> toSource)
>>
>> - allow full rewrite of js (maybe on Flush)
>>
>> looking for approbiate js-source of a class that implements
>> nsIRDFDataSource and nsIRDFRemoteDataSource (like nsLDAPDataSource)
>>
>> Anyone did this before?
>>
>
> Your model may be ok for your DS, but in general, it won't work, as
> there can be more than one arc with the same source and predicates,
> which js objects don't support.

Yes, missed that point,
but it would be possible to replace the single target value with an
array of target values if necessary.

>
> I wouldn't know how to represent resource targets in arcs, either.
> Unless xx and xy would be nsIRDFNode objects, but that of course doesn't
> serialize per se.
 >

Resource targets are just strings, or {resource:string} objects or a
special JS class. But because I don't enumeration from targets I could
omit the extra code.

All of the standard nsIRDFNode derivates have a Value attribute, which
can be used (only nsIRDFBlob doesn't have, but it's not useful by as JS
only application anyway).

>
> There is no systematical problem with creating a rdfds impl in js, you
> just have to, like with a C++ impl, play nice with the RDF Service.
>

Yes, I know .. thats why I'm asking for an existing impl. because it's a
bunch of work ;-)
Anyway, thanks for your comments.

Harry
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

Neil-4
In reply to this post by harry-6
Harry wrote:

> looking for approbiate js-source of a class that implements
> nsIRDFDataSource and nsIRDFRemoteDataSource

Perhaps you could write a wrapper around the in-memory datasource that
just handled serialization and delegated everything else?

--
Warning: May contain traces of nuts.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf
Reply | Threaded
Open this post in threaded view
|

Re: Is there a pure JS implementation of IRDFDataSource and storing values as .js instead of .rdf?

harry-6
Neil wrote:
> Harry wrote:
>
>> looking for approbiate js-source of a class that implements
>> nsIRDFDataSource and nsIRDFRemoteDataSource
>
> Perhaps you could write a wrapper around the in-memory datasource that
> just handled serialization and delegated everything else?
>

Well, the main goal is to replace the slow serialization of large files
   (>30MB) also having a crash save 'append'. I don't really know wether
it works but I hope. I also don't really need full RDF support, but it
would ease the change.
_______________________________________________
dev-tech-rdf mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-tech-rdf