Re: [topbraid-users] Create individuals from XML file using existing ontology

2017-11-23 Thread Irene Polikoff
The easiest approach is to import XSD for your XML files which creates OWL 
ontology, then XML files that correspond to it can be auto-transformed to RDF. 
If you don’t have XSD, there tools which will generate one for you from XML 
files. It may be possible to annotate the ontology you have already created so 
it can be used by the auto-conversion. You will need to experiment with this - 
convert some XSD, observe how annotations look like, etc.

In the absence of this, you can convert any XML into RDF using the generic 
Semantic XML approach and then write rules to transform it according to your 
ontology.

For more details, read the two pages in TBC Help under: TopBraid Composer > 
Importing Data Sources > Import external information > Importing XML and XSD.


> On Nov 23, 2017, at 3:55 AM, Glykeria Alvanou  wrote:
> 
> Hi,
> 
> I have created an ontology (.ttl) manually -without using any tool-  and it's 
> based on XML representation. What I want to do is to import many XML files 
> and create individuals which correspond to the existing ontology. How can I 
> achieved the mapping between the XML files and the ontology using TopBraid?
> 
> Note that probably the ontology as it is now doesn't correspond 100% to the 
> XML files e.g. not all the XML elements match the ontology classes.
> 
> Any tip would be helpful.
> 
> Thank you,
> Glykeria
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to topbraid-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [topbraid-users] [SPIN API] Passing arguments to constructors at runtime

2017-11-23 Thread Martynas Jusevicius
I thought spin:Template (possibly with arguments) can be used anywhere 
sp:Query can be used, including constructors?

On Thursday, November 23, 2017 at 11:44:22 PM UTC+1, Holger Knublauch wrote:
>
> Hi,
>
> SPIN constructors don't have a facility for parameters, making their use 
> rather limited. Given that SPIN is not an official standard anyway, why not 
> make up your own property and do what you want there?
>
> Holger
>
>
> On 24/11/2017 4:25, Martynas Jusevicius wrote:
>
> Hi,
>
> I am using this code to construct class instance:
>
> List newResources = new ArrayList<>();
> Set reachedTypes = new HashSet<>();
> OntModel ontModel = forClass.getOntModel();
> Map class2Constructor = 
> SPINQueryFinder.getClass2QueryMap(ontModel, ontModel, property, false, 
> false);
> SPINConstructors.constructInstance(ontModel, instance, forClass, 
> targetModel, newResources, reachedTypes, class2Constructor, null, null, 
> null);
>
> Is it possible to pass initial binding(s) to constructors at runtime? 
> Something that would correspond to:
>
> :ConstructorWithBase a spin:Template ;
> spin:body :OriginalConstructor ;
> spin:constraint [ a spl:Argument ;
> spl:predicate :base ;
> spl:valueType rdfs:Resource
> ] ;
>
> Does that mean I have to walk all the constructors and turn them into 
> spin:Templates with arguments as above? Which would require me to copy the 
> model, as it is reused by different applications passing different 
> arguments.
>
> Ultimately I am looking for a way to pass a base URI into the query (in a 
> generic way). Right now I have written my own version of 
> constructInstance() that simply accepts and sets BASE on the query, but I 
> would like to reuse SPIN machinery if possible, and a binding would work as 
> well.
>
> Martynas
> atomgraph.com
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to topbraid-user...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [topbraid-users] [SPIN API] Executing spin:fix

2017-11-23 Thread Simon Schlosser
Thank you so much! Works as exected!

Yes, I am thinking or better said, I've already decided to switch to SHACL. 
But unfortunately the transition will take some time due to some 
specialties that we've introduced and from which I want and have to become 
rid of.

Simon

Am Donnerstag, 23. November 2017 23:51:08 UTC+1 schrieb Holger Knublauch:
>
> Hi Simon,
>
> the only code that executes those fixes in our code base is in 
> TopBraid-specific extensions, so I cannot help out of the box. Some 
> untested snippet:
>
> Command command = templateCall.getTemplate().getBody();
> Update spinUpdate = SPINFactory.asUpdate(command);
> UpdateRequest updateRequest = 
> ARQFactory.get().createUpdateRequest(spinUpdate);
> DatasetGraph graphStore = createDatasetGraph();
> UpdateProcessor processor = 
> UpdateExecutionFactory.create(updateRequest, graphStore, initialBinding);
> processor.execute(); 
>
> As a general note, have you explored using SHACL for this? There is a 
> Suggestions vocabulary that we are using in TopBraid now as well
>
> http://datashapes.org/suggestions.html
>
> and which is arguably easier to use as it doesn't require the extra step 
> through a template.
>
> Holger
>
>
>
> On 24/11/2017 5:28, Simon Schlosser wrote:
>
> Hi all, 
> I am struggling with creating fixes programmatically. All my search 
> efforts did not provide me with any code snippet that would show how to 
> apply them.
>
> My problem: I have a ConstraintViolation object and via getFixes() I get a 
> Collection. My defined spin:fix in the construct part of the 
> spin constraint seems to be available as e.g. the ArgumentsMap of the 
> TemplateCall contains my expected values (e.g. the Update Template that 
> should fix the error by inserting a new triple. Now, I am totally lost how 
> to execute the "fix".
>
> Are there any code examples?
>
> Thanks,
> Simon
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to topbraid-user...@googlegroups.com .
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[topbraid-users] Create individuals from XML file using existing ontology

2017-11-23 Thread Glykeria Alvanou
Hi,

I have created an ontology (.ttl) manually -without using any tool-  and 
it's based on XML representation. What I want to do is to import many XML 
files and create individuals which correspond to the existing ontology. How 
can I achieved the mapping between the XML files and the ontology using 
TopBraid?

Note that probably the ontology as it is now doesn't correspond 100% to the 
XML files e.g. not all the XML elements match the ontology classes.

Any tip would be helpful.

Thank you,
Glykeria

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [topbraid-users] [SPIN API] Executing spin:fix

2017-11-23 Thread Holger Knublauch

Hi Simon,

the only code that executes those fixes in our code base is in 
TopBraid-specific extensions, so I cannot help out of the box. Some 
untested snippet:


        Command command = templateCall.getTemplate().getBody();
        Update spinUpdate = SPINFactory.asUpdate(command);
        UpdateRequest updateRequest = 
ARQFactory.get().createUpdateRequest(spinUpdate);

        DatasetGraph graphStore = createDatasetGraph();
        UpdateProcessor processor = 
UpdateExecutionFactory.create(updateRequest, graphStore, initialBinding);

        processor.execute();

As a general note, have you explored using SHACL for this? There is a 
Suggestions vocabulary that we are using in TopBraid now as well


    http://datashapes.org/suggestions.html

and which is arguably easier to use as it doesn't require the extra step 
through a template.


Holger



On 24/11/2017 5:28, Simon Schlosser wrote:

Hi all,
I am struggling with creating fixes programmatically. All my search 
efforts did not provide me with any code snippet that would show how 
to apply them.


My problem: I have a ConstraintViolation object and via getFixes() I 
get a Collection. My defined spin:fix in the construct 
part of the spin constraint seems to be available as e.g. the 
ArgumentsMap of the TemplateCall contains my expected values (e.g. the 
Update Template that should fix the error by inserting a new triple. 
Now, I am totally lost how to execute the "fix".


Are there any code examples?

Thanks,
Simon
--
You received this message because you are subscribed to the Google 
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to topbraid-users+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "TopBraid 
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [topbraid-users] [SPIN API] Passing arguments to constructors at runtime

2017-11-23 Thread Holger Knublauch

Hi,

SPIN constructors don't have a facility for parameters, making their use 
rather limited. Given that SPIN is not an official standard anyway, why 
not make up your own property and do what you want there?


Holger


On 24/11/2017 4:25, Martynas Jusevicius wrote:

Hi,

I am using this code to construct class instance:

    List newResources = new ArrayList<>();
    Set reachedTypes = new HashSet<>();
    OntModel ontModel = forClass.getOntModel();
    Map class2Constructor = 
SPINQueryFinder.getClass2QueryMap(ontModel, ontModel, property, false, 
false);
    SPINConstructors.constructInstance(ontModel, instance, 
forClass, targetModel, newResources, reachedTypes, class2Constructor, 
null, null, null);


Is it possible to pass initial binding(s) to constructors at runtime? 
Something that would correspond to:


    :ConstructorWithBase a spin:Template ;
        spin:body :OriginalConstructor ;
        spin:constraint [ a spl:Argument ;
            spl:predicate :base ;
            spl:valueType rdfs:Resource
        ] ;

Does that mean I have to walk all the constructors and turn them into 
spin:Templates with arguments as above? Which would require me to copy 
the model, as it is reused by different applications passing different 
arguments.


Ultimately I am looking for a way to pass a base URI into the query 
(in a generic way). Right now I have written my own version of 
constructInstance() that simply accepts and sets BASE on the query, 
but I would like to reuse SPIN machinery if possible, and a binding 
would work as well.


Martynas
atomgraph.com
--
You received this message because you are subscribed to the Google 
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to topbraid-users+unsubscr...@googlegroups.com 
.

For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "TopBraid 
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[topbraid-users] [SPIN API] Executing spin:fix

2017-11-23 Thread Simon Schlosser
Hi all,
I am struggling with creating fixes programmatically. All my search efforts 
did not provide me with any code snippet that would show how to apply them.

My problem: I have a ConstraintViolation object and via getFixes() I get a 
Collection. My defined spin:fix in the construct part of the 
spin constraint seems to be available as e.g. the ArgumentsMap of the 
TemplateCall contains my expected values (e.g. the Update Template that 
should fix the error by inserting a new triple. Now, I am totally lost how 
to execute the "fix".

Are there any code examples?

Thanks,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [topbraid-users] Abridged summary of topbraid-users@googlegroups.com - 8 updates in 1 topic

2017-11-23 Thread Jack Hodges
Michel,

Irene and TopQuadrant are not responsible for QUDT, though they are
intimately familiar with it. She is addressing your general import question
into TBC. For any QUDT import issues you would need to talk to someone in
QUDT.org. Granted, at present Ralph knows more about the ontologies than
anyone else (combined and multiplied), but it is probably best to keep the
two questions separate unless they collide.

Jack

On Thu, Nov 23, 2017 at 2:19 AM,  wrote:

> topbraid-users@googlegroups.com
> 
>  Google
> Groups
> 
> 
> Today's topic summary
> View all topics
> 
>
>- puzzled (unit:YR as datatype revisited)
><#m_7774923946819858503_group_thread_0> - 8 Updates
>
> puzzled (unit:YR as datatype revisited)
> 
> "Bohms, H.M. (Michel)" : Nov 22 12:19PM
>
> I imported qudt:Unit and all its instances:
>
> [cid:image001.png@01D3638B.380DD170]
> They are all there including YR:
>
> [cid:image002.png@01D3638B.380DD170]
>
> I also import an ontology stating:
> ...more
> 
> Irene Polikoff : Nov 22 09:22AM -0500
>
> Your last screenshot shows quit:Unit with a globe icon. Typically, when
> this happens it means that the type of the resource is unknown.
>
> Are you sure that QUDT is included?
>
> ...more
> 
> "Bohms, H.M. (Michel)" : Nov 22 02:33PM
>
> I saw this hint too indeed but when I just browse to it (in the same
> ontology) it is there:
>
> [cid:image001.png@01D363A7.38EC39D0]
>
> and you can also see it is imported: ...more
> 
> "Bohms, H.M. (Michel)" : Nov 22 02:36PM
>
> Similar to the other question on units I see in latest qudt ontology:
>
> # baseURI: http://qudt.org/2.0/schema/qudt
> # imports: http://www.linkedmodel.org/schema/dtype ...more
> 
> "Bohms, H.M. (Michel)" : Nov 22 02:44PM
>
> When I change the prefix to the baseURIs the globe at least disappears
> No units yet, but that is likely caused by the same issue for the unit
> files…..
> I’ll see if that helps, tbc
>
>
>
>
> ...more
> 
> "Bohms, H.M. (Michel)" : Nov 22 03:06PM
>
> ADAPTATIONS
>
> For
> SCHEMA_QUDT-v2.0.ttl
> SCHEMA_QUDT-SCIENCE-v2.0.ttl
> VOCAB_QUDT-UNITS-BASE-v2.0.ttl
> VOCAB_QUDT-UNITS-SPACE-AND-TIME-v2.0.ttl
> VOCAB_QUDT-UNITS-MECHANICS-v2.0.ttl ...more
> 
> Irene Polikoff : Nov 22 10:27AM -0500
>
> The best practice is to have each prefix declaration in one place only.
> Otherwise, you may end up with a situation where the same prefix is
> associated with two different namespaces and then the tool ...more
> 
> "Bohms, H.M. (Michel)" : Nov 22 04:12PM
>
> Right, so can you confirm this is at the moment an issue for qudt2 files?
>
> Say 2 files both having ‘unit’ prefix but related to a different uri
> (although hsaring large part of that uri)
>
>
>
> ...more
> 
> Back to top <#m_7774923946819858503_digest_top>
> You received this digest because you're subscribed to updates for this
> group. You can change your settings on the group membership page
> 
> .
> To unsubscribe from this group and stop receiving emails from it send an
> email to topbraid-users+unsubscr...@googlegroups.com.
>



-- 
Jack

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.