Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can LD-R be used to create new entities? #3

Closed
angelf opened this issue Aug 13, 2015 · 3 comments
Closed

Can LD-R be used to create new entities? #3

angelf opened this issue Aug 13, 2015 · 3 comments

Comments

@angelf
Copy link

angelf commented Aug 13, 2015

Hi,

This looks very exciting. It's great work indeed. One question: can LD-R be used at this point to create new objects or add new properties to an existing object (as opposed to editing existing properties)? I couldn't find any of this on the demo, documentation, or roadmap.

Thank-you!

@ali1k
Copy link
Owner

ali1k commented Aug 13, 2015

Hi @angelf ,
at the moment you can only edit existing RDF resources (i.e. cannot add new resources). However, there is a config called 'allowExtension' which provides a feature to add arbitrary properties to a resource object. You can checkout an example at https://github.com/ali1k/ld-r/blob/master/configs/reactor.sample.js
line 89 which shows adding extensions for a property.

@angelf
Copy link
Author

angelf commented Aug 14, 2015

Hi,

Thank-you. I have reviewed the sample config but I am struggling a bit on the workings of allowExtension. If I understand it correctly allowExtension enables editing of properties of related resources. So, in reactor.sample.js enabling allowExtension on 'http://purl.org/dc/terms/creator' and defining the extensions specs allows me to edit the rdfs:label, foaf:mbox, and rdf:label properties on the relateddct:creator resource.

What I want to this point is something more basic: just allowing users to enter new literal properties to an object. So far I am able to edit literal properties, as long as they already have a value, but I can't see how to define new literals on an existing resource.

To make it a bit more concrete, let's say I want to enable adding the dct:description property in any Resource on my dataset, I would expect this

                'http://purl.org/dc/terms/description': {
                    label: ['Textual description'],
                    hint: ['A textual description of the dataset.'],
                    objectIEditor: ['BasicTextareaInput'],
                    allowExtension: 1,

would allow me to add this property.

What am I getting wrong?

@ali1k
Copy link
Owner

ali1k commented Aug 15, 2015

'allowExtension' allows extending resources derived from current resources. If you enable 'allowNewValue' together with 'allowExtension' on a property with URI object values, then you can add details to the object after its creation. E.g in the config for http://purl.org/dc/terms/creator property, if I add an object like http://ali1k.com then I can click on the 'add details button' and will get the properties defined in the 'extensions' array. This will allow you to add non-existing properties to this resource. For your example, you need to add the following config to the 'generic' property config:

'generic': {
allowExtension: 1,
allowNewValue: 1,
extensions: [
 {
      spec: {
                 propertyURI: 'http://purl.org/dc/terms/description',
                 instances: [{value: 'desc...', valueType: 'literal'}]
        },
       config: {
            label: ['Description']
      }
 }
]
}

@ali1k ali1k closed this as completed Aug 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants