DaniFdezAlvarez / shexer

Apache License 2.0
26 stars 2 forks source link

incorrect shape? #140

Closed jjkoehorst closed 1 year ago

jjkoehorst commented 1 year ago

The following code

# shape_map_raw = "SPARQL'SELECT DISTINCT ?object where { ?s <http://example.org/sample> ?object } LIMIT 100'@<Flag>"

target_classes = [
    "http://example.org/Sample"
]

shaper = Shaper(
    target_classes=target_classes,
    # shape_map_raw=shape_map_raw,
    url_endpoint="http://sparql.systemsbiology.nl/repositories/biosamples",
    namespaces_dict=namespaces_dict,
    instantiation_property="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
    disable_comments=True,
    depth_for_building_subgraph=2,
    track_classes_for_entities_at_last_depth_level=False,
    all_classes_mode=False,
    limit_remote_instances=100)

str_result = shaper.shex_graph(string_output=True)

print(str_result)

generates the following shape

:Sample
{
   rdf:type  [ex:Sample]  ;
   ex:accession  xsd:string  ;
   ex:identifiers  xsd:string  ;
   ex:sampleAttributes  xsd:string  ;
   ex:sampleName  xsd:string  ;
   ex:centerName  xsd:string  ;
   ex:sampleLinks  xsd:string  ?;
   ex:alias  xsd:string  ?;
   ex:title  xsd:string  ?;
   ex:description  xsd:string  ?;
   ex:brokerName  xsd:string  ?;
   ex:alias  xsd:integer  ?;
   ex:title  xsd:float  ?;
   ex:title  xsd:integer  ?
}

However http://sparql.systemsbiology.nl/sparql?name=&infer=true&sameAs=true&query=PREFIX%20ex:%20%3Chttp:%2F%2Fexample.org%2F%3E%0Aselect%20*%20where%20%7B%20%0A%09%3Fs%20a%20%20ex:Sample%20.%0A%20%20%20%20%3Fs%20%20ex:sampleAttributes%20%3Fatt%20.%0A%7D%20limit%20100%20%0A

PREFIX ex: <http://example.org/>
select * where { 
    ?s a  ex:Sample .
    ?s  ex:sampleAttributes ?att .
} limit 100 

s | att
-- | --
1 | urn:uuid:41a4927c-3f43-4f89-81c5-b98b808c98ec | urn:uuid:707b5139-2762-4ac0-ad68-11069d54e0c7
2 | urn:uuid:d0ee88cf-1849-42a8-8f8a-01c1b0f27177 | urn:uuid:f1ba8e48-856f-46d5-963c-3d3afcb40829
3 | urn:uuid:f9fbf2fc-5280-4ef0-9339-2ea8b4359a17 | urn:uuid:37294e48-c0a2-47a7-90b1-c8d3c48c9ea3
4 | urn:uuid:a8c61bc9-ca0d-4f31-a2f7-d1d32a2f9c79 | urn:uuid:7442701a-4f6c-47e9-a5fa-4ad6e3a04e80

shows that ex:sampleAttributes xsd:string ; should be an IRI?

DaniFdezAlvarez commented 1 year ago

yes, you are right @jjkoehorst . This is related to #134, again a problem with IRIs not starting by http. I'll fix it