OK, that is quite a different problem.  One solution is to use the out-
of-the box converter in EVN - option 3 in the above. This takes a bit
of setup for EVN and then a couple of steps: export the model from EVN
and convert skos:borader to rdfs:subClassOf.

If you want to follow that option, which does work nicely, let me know
and we can walk you through that.

Another approach would be to use SPIN to process a query for each row
of the spreadsheet.  The steps are as follows:

1. Create a SPIN file via New > RDF/OWL/SPIN file.  Click on SKOS to
import that model.

2. Right click on the .xls file and choose Open With... > TopBraid
(Excel Documents)

3. When the wizard asks whether you have a Schema, choose "Yes" and
choose the file you created in step 1.

4. Open the class created by the .xls import and copy the following
query into the spin:rule property (for the class):

CONSTRUCT {
    ?r1 a owl:Class .
    ?r2 a owl:Class .
    ?r3 a owl:Class .
    ?termRsc a owl:Class .
    ?r2 rdfs:subClassOf ?r1 .
    ?r3 rdfs:subClassOf ?r2 .
    ?termRsc rdfs:subClassOf ?r3 .
    ?termRsc skos:definition ?def .
    ?termRsc skos:altLabel ?label .
    ?termRsc ontolearner:termAcronym ?acronym .
}
WHERE {
    ?this ontolearner:category1 ?c1 .
    ?this ontolearner:term ?term .
    OPTIONAL {?this ontolearner:category2 ?c2 .} .
    OPTIONAL {?this ontolearner:category3 ?c3 .} .
    OPTIONAL {?this ontolearner:termAcronymtermAcronym ?acronym .} .
    OPTIONAL {?this ontolearner:termDefinitionskosdefinition ?def .} .
    OPTIONAL {?this ontolearner:termSynonymskosaltLabel ?label .} .
    BIND (IRI(fn:concat("http://example.org/classes#";, REPLACE(?term,
" ", ""))) AS ?termRsc) .
    BIND (IRI(fn:concat("http://example.org/classes#";, REPLACE(?c1, "
", ""))) AS ?r1) .
    BIND (IRI(fn:concat("http://example.org/classes#";, REPLACE(?c2, "
", ""))) AS ?r2) .
    BIND (IRI(fn:concat("http://example.org/classes#";, REPLACE(?c3, "
", ""))) AS ?r3) .
}

...note that your prefixes an properties may be different.  Adjust as
needed.  There's a lot to this query, so if you have questions, let us
know.

5. Make sure the TopSPIN engine is configured.  See Help > How to? >
Run and Configure Inference Engines

Execute the inference and your subclass tree will be inferred.  From
there you can adjust the query as needed to get the data to look the
way you want it to.  If you want to assert these, choose the inferred
triples in the Inferences View (bottom-middle row of tabs), select the
triples then choose "Assert selected statements" (the arrow pointing
up).

HTH

-- Scott

On Oct 29, 4:03 pm, OntoLearner <[email protected]> wrote:
> Thanks a lot Scott,
>
> I have tried to follow the first 2 steps but I am not getting the desired
> results:
>
> Basically what I need is to be able to make category 1 the top category,
> then category 2 becomes subClassOf of category 1, then category 3 becomes
> subClassOf of category 2, then the term is becomes a child of category 3.
> Because the term may have or may not have a synonym, acronym, and/or
> definition, I would like to have them created but optionally.
>
> I have attached my rdf file after the conversion for easy reference.
>
> Thank you again for your help as I am still learning.
>
>
>
>
>
>
>
> On Monday, October 29, 2012 3:51:02 PM UTC-4, Scott Henninger wrote:
>
> > Funble-fingers errantly hit a key.  The last part of the query is:
>
> > SELECT *
> > WHERE
> > { ?s :category1 ?c1 .
> >   ?s :category2 ?c2 .
> >   ?s :catefory3 ?c3 .
> >   OPTIONAL { ?s skos:definition ?def }
> >   OPTIONAL { ?s skos:altLabel ?label }
> > }
>
> > -- Scott
>
> > On Oct 29, 2:49 pm, Scott Henninger <[email protected]>
> > wrote:
> > > OntoLearner;  I wasn't clear on how you were getting the spreadsheet
> > > into triples.  Here are two possibilities:
>
> > > 1. Tab-delimited file
>
> > > In this case, I'd suggest using tab-delimited import (see Help > >
> > > Importing Data Sources > Import external information > Import
> > > Spreadsheets
> > > Import Tab-Separated Spreadsheets, part 2 "Importing the spreadsheet
> > > to the currently selected ontology".
>
> > > This would require adding a first column that named the class you
> > > import into (row 0, column 0) and each instance (name them anything,
> > > you can always re-name them via SPARQL transforms later.  An outline
> > > of the process:
> > >   a. Create a file and import SKOS
> > >   b. Create a class definition that corresponds to row 0, column 0
> > >   c. Right-click the file in the Navigator and choose Import >
> > > TopBraid Composer > Import Tab-Delimited Spreadsheet File
> > >   d. In first page of wizard, be sure to choose "Import to the current
> > > ontology"
> > >   e. In last page of wizard, you can change the types (Property Range)
> > > to skos:altLabel, skos:definition, etc
>
> > > 2. Excel (.xls) import
>
> > > In this case, open the file in Excel and save as a .xls file.  Place
> > > in Composer's navigator (copy/paste or drag/drop) and open this
> > > directly in Composer - open with... > TopBraid (Excel Documents)
>
> > > The effect will be similar to 1., except that the instances and class
> > > will be named in order.  Again, you can use a SPARQL transformation to
> > > rename as needed.
>
> > > 3.  EVN Spreadsheet import
>
> > > In this case the spreadsheet you outline can be converted into a
> > > hierarchy with the spreadsheet importer.  See the Column-Based Tree
> > athttp://topquadrant.com/topbraid/evn/362doc/userguide.html#importing-s...
>
> > > There was a question about how to make something optional in a query.
> > > Again, I don't know exactly how your data shows in triples, but the
> > > SPARQL would look something like:
>
> > > SELECT *
> > > WHERE
> > > { ?s :category1 ?c1 .
> > >   ?s :category2 ?c2 .
> > >   ?s :catefory3 ?c3 .
> > >   OPTIONAL { ?s skos:definition }
> > >   OPTIONAL
>
> > > On Oct 29, 1:38 pm, OntoLearner <[email protected]> wrote:
>
> > > > Hello,
>
> > > > I am trying to convert the below spreadsheet using SPARQL.
>
> > > > I would like to create a taxonomy, which has top 3, 4, or 5 categories
> > with
> > > > the term as the lowest being element. The term can have a synonym
> > and/or
> > > > acronym, and a definition.
>
> > > > Because the synonym, acronym, and definition may exist or not, I want
> > to
> > > > make them optional in my query.
>
> > > > Hopefully someone can help with the above.
>
> > > > I am able to import the spreadsheet into spreadsheet ontology inside
> > TBCME,
> > > > but I am struggling to create the categories together with the terms
> > and
> > > > its synonym, acronym or definition.
>
> > > >    Category 1 Category 2 Category 3 Term Term synonym (skos:altLabel)
> > Term
> > > > Acronym(termAcronym) Term Definition (skos:definition)  Test 1 Test 2
> > Test 3
> > > > Term1 Acronym 1  Test 1 Test 2 Test 3 Term2 Synonym 2 Acronym 2 Sample
> > > > definition  Test 1 Test 2 Test 3 Term3 Synonym 3   Test 1 Test 2 Test
> > 3
> > > > Term4 Synonym 4 Acronym 4 Sample definition  Test 1 Test 2 Test 3
> > Term5 Synonym
> > > > 5 Acronym 5  Test 1 Test 2 Test 3 Term6 Synonym 6   Test 1 Test 2 Test
> > 3
> > > > Term7 Synonym 7 Acronym 7  Test 1 Test 2 Test 3 Term8 Acronym 8  Test
> > 1 Test
> > > > 2 Test 3 Term9 Synonym 9 Acronym 9  Test 1 Test 2 Test 3 Term10
> > Synonym 10 Acronym
> > > > 10  Test 1 Test 2 Test 3 Term11 Acronym 11
>
> > > > Thank you for your help.
>
>
>
>  category.rdf
> 5KViewDownload

-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en


Reply via email to