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

Missing Schema When Reading in Turtle File #117

Open
Sulstice opened this issue May 5, 2023 · 1 comment
Open

Missing Schema When Reading in Turtle File #117

Sulstice opened this issue May 5, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@Sulstice
Copy link

Sulstice commented May 5, 2023

Hi,

I am receiving this error:

  File "schema_automator/generalizers/rdf_data_generalizer.py", line 43, in convert
    sv = SchemaView(schemas[0])
IndexError: list index out of range

And the command I am running:

schemauto --verbose generalize-rdf graph.ttl -d link_ml

I'm wondering is there something wrong with my initial turtle file. I produced the graph with RDFLib and here is an example of the output in n3 notation:

import rdflib
graph = rdflib.Graph()
....
graph.serialize(destination='graph.ttl', format='n3')

Here's an example of the input

@prefix ns1: <#> .

<#/%28%2B%29-norpseudoephedrine> ns1:connectsTo <#/schedule_four> .

<#/%28%C2%B1%29cis-4-methylaminorex> ns1:connectsTo <#/schedule_one> .

<#/%281%2C1%E2%80%B2%2C3%2C3%E2%80%B2-tetraoxo%5B5%2C5%E2%80%B2-biisoindoline%5D-2%2C2%E2%80%B2-diyl%29biphenyl> ns1:connectsTo <#/common_monomer_repeating_units> .

<#/%281%2C1-dioxobenzo%5Bb%5Dthiophene-2-yl%29methyloxycarbonyl> ns1:connectsTo <#/amino_acid_protecting_groups> .

<#/%281%2C1-dioxonaptho%5B1%2C2-b%5Dthiophene-2-yl%29methyloxycarbonyl> ns1:connectsTo <#/amino_acid_protecting_groups> .

<#/%281R%2C4S%2C
@Sulstice Sulstice added the enhancement New feature or request label May 5, 2023
@caufieldjh
Copy link

Hi @Sulstice,
Yes - I think your input may need to take a form more like this:

@base <http://example.org/> .
@prefix ns1: <http://www.w3.org/ns/1#> .

<#%28%2B%29-norpseudoephedrine>
    ns1:connectsTo <#schedule_four> ;
    a ns1:Category .

<#%28%C2%B1%29cis-4-methylaminorex>
    ns1:connectsTo <#schedule_one> ;
    a ns1:Category .

I think the general issue is that, without specifying at least what the object in each of these triples is, there really isn't enough to generalize into a schema. Either that or schemaview is just very particular about what needs to be present in a schema.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants