Skip to content

@optional bugged #35

@renevds

Description

@renevds

The following query:

{
      name @single
      image @single
      readMoreUrl @single
      rml @single
      knowledgeGraph @optional @single
}

On the following ttl file:

@prefix ex: <http://example.com/rmlio/> .
@prefix kees: <http://linkeddata.center/kees/v1#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .

<https://rml.io/usecases/BESOCIAL> a ex:useCase;
  ex:rules "https://github.com/RMLio/social-media-archiving/tree/master/mappings";
  schema:description """<a href=\"https://www.kbr.be/en/projects/besocial/\">BESOCIAL</a> is a cross-institutional research project,
aiming to develop a sustainable strategy for archiving and preserving social media in Belgium.
Heterogeneous social media content, provenance information provided by web archivists as well as preservation metadata enclosed in web archive (WARC) files characterize this use case.
A developed <a href=\"https://github.com/RMLio/social-media-archiving\">open source component</a> integrates RML.io into the existing <a href=\"https://gwu-libraries.github.io/sfm-ui/\">Social Feed Manager (SFM)</a> framework from the George Washington University Libraries.
Therefore, RML.io supports data stewardship tasks in a sustainable open source workflow by mapping heterogeneous data on the fly to a knowledge graph.
This use case uses RML rules in <a href=\"https://rml.io/yarrrml/\">YARRRML</a> syntax which are used by a <a href=\"https://github.com/RMLio/rmlmapper-java-wrapper-js\">javascript wrapper</a> of the <a href=\"https://github.com/RMLio/rmlmapper-java\">RMLMapper</a> to generate the knowledge graph.""";
  schema:image "/img/use-cases/besocial.jpg";
  schema:name "BESOCIAL";
  schema:url "https://github.com/RMLio/social-media-archiving" .

<https://rml.io/usecases/Between%20Our%20Worlds> a ex:useCase;
  ex:rules "https://github.com/BetweenOurWorlds/generation-rules";
  kees:KnowledgeGraph "https://data.betweenourworlds.org/latest";
  schema:description "Between Our Worlds is an initiative to provide metadata information about anime as Linked Open Data. It uses <a href=\"https://rml.io/yarrrml\">YARRRML</a>, which is converted to RML, to define how the knowledge graph is generated based on the metadata downloaded from a Web API. <a href=\"https://fno.io/\">FnO</a> is used to transform certain aspects of the original data. The <a href=\"https://github.com/RMLio/rmlmapper-java\">RMLMapper</a> is used to execute the RML rules to generate the knowledge graph.";
  schema:downloadUrl "http://docs.kitsu.apiary.io/";
  schema:image "/img/use-cases/between-our-worlds.png";
  schema:name "Between Our Worlds";
  schema:url "https://betweenourworlds.org" .

<https://rml.io/usecases/COVID%2019%20Knowledge%20Graph> a ex:useCase;
  ex:rules "https://github.com/GillesVandewiele/COVID-KG/tree/master/rml";
  kees:KnowledgeGraph "https://www.kaggle.com/group16/covid19-literature-knowledge-graph";
  schema:description "This use case generates a <a href=\"https://www.kaggle.com/group16/covid19-literature-knowledge-graph\">knowledge graph</a> from the COVID-19 literature. It uses <a href=\"https://rml.io/yarrrml\">YARRRML</a>, which is converted to RML, to define how the knowledge graph is generated based on the metadata of the literature. <a href=\"https://rml.io/yarrrml/matey/\">Matey</a> is used to assist in defining the YARRRML rules and the <a href=\"https://github.com/RMLio/rmlmapper-java\">RMLMapper</a> is used to execute the RML rules to generate the knowledge graph.";
  schema:downloadUrl "https://www.kaggle.com/allen-institute-for-ai/CORD-19-research-challenge";
  schema:image "/img/use-cases/covid-19-kg.jpg";
  schema:name "COVID 19 Knowledge Graph";
  schema:url "https://github.com/GillesVandewiele/COVID-KG" .

<https://rml.io/usecases/European%20Union%20Agency%20for%20Railways> a ex:useCase;
  ex:rules "https://github.com/julianrojas87/era-data-mappings/tree/master/rml";
  kees:KnowledgeGraph "http://era.ilabt.imec.be/query/";
  schema:description "The European Union Agency for Railways (ERA) generates a knowledge graph to foster interoperability across their base registry databases which are populated by all EU member states and different actors from the railway domain. This use case uses <a href=\"https://rml.io/yarrrml\">YARRRML</a>, which is automatically converted to RML, to define how the knowledge graph is generated based on different data sources, such as databases, CSV files, XML files, and so on. The <a href=\"https://github.com/RMLio/rmlmapper-java\">RMLMapper</a> is used to execute the RML rules to generate the knowledge graph, which can be explored and queried online.";
  schema:downloadUrl "https://github.com/julianrojas87/era-data-mappings/tree/master/data";
  schema:image "/img/use-cases/era.jpg";
  schema:name "European Union Agency for Railways";
  schema:url "https://www.era.europa.eu/" .

<https://rml.io/usecases/Montolo> a ex:useCase;
  ex:rules "https://github.com/IDLabResearch/Montolo/blob/master/montolo-raw/montolo.yml";
  kees:KnowledgeGraph "https://w3id.org/montolo/ns/montolo/";
  schema:description """<a href=\"https://w3id.org/montolo\">Montolo</a> is a knowledge graph with the aim to provide FAIR metadata of ontologies to support knowledge modeling tasks such as the assessment and reuse of existing ontologies,
currently existing related datasets are <a href=\"https://doi.org/10.5281/zenodo.3343052\">MontoloStats</a> for ontologies and <a href=\"https://doi.org/10.5281/zenodo.3988929\">MontoloSHACLStats</a> for data shapes.
The Montolo Knowledge Graph is manually curated using CSV files on <a href=\"https://github.com/IDLabResearch/Montolo/tree/master/montolo-raw\">GitHub</a> including an alignment with the <a href=\"https://zenodo.org/record/3626676\">Astrea Knowledge Graph</a>.
This use case uses <a href=\"https://rml.io/yarrrml\">YARRRML</a>, which is automatically converted
to RML, to define how the knowledge graph is generated.
The <a href=\"https://github.com/RMLio/rmlmapper-java\">RMLMapper</a> is used to execute the RML rules to generate the knowledge graph.""";
  schema:downloadUrl "https://github.com/IDLabResearch/Montolo/tree/master/montolo-raw";
  schema:image "/img/use-cases/montolo.jpg";
  schema:name "Montolo";
  schema:url "https://w3id.org/montolo" .

<https://rml.io/usecases/Sollicimeer%20%28Inclusion%20in%204D%29> a ex:useCase;
  schema:description "Sollicimeer is a job application platform for people with a learning disability. Companies provide their job applications using a spreadsheet. It uses <a href=\"https://rml.io/yarrrml\">YARRRML</a>, which is converted to RML, to define how knowledge graphs are generated based on the data in the spreadsheet. Next, each knowledge graph is added to the company's <a href=\"https://solidproject.org/\">Solid POD</a>. When a person wants to apply for a job the relevant application information is read from the POD and during the application the information about the person is stored in their personal POD.";
  schema:image "/img/use-cases/sollicimeer.png";
  schema:name "Sollicimeer (Inclusion in 4D)";
  schema:url "http://hellojennywordpress.azurewebsites.net/index.php/uitdaging-2-solliciteren-met-een-leerstoornis/" .

<https://rml.io/usecases/Velopark> a ex:useCase;
  ex:rules "https://github.com/linkedtimeseries/timeseries-server/tree/develop/mappings";
  schema:description "To facilitate information access to bicycle users about parking infrastructure, Fietsberaad, a pro-cycling organization managed by the Flemish government, worked together with local authorities, parking facility owners and operators in Belgium to design common framework for modeling and publishing (live) information of parking facilities. Existing data and interfaces (APIs) were reused and transformed to a common <a href=\"https://velopark.ilabt.imec.be/openvelopark/vocabulary\">semantic data representation</a> using <a href=\"https://github.com/linkedtimeseries/timeseries-server/tree/develop/mappings\">RML rules</a> in YARRRML syntax. Currently more than 30 municipalities across Belgium publish data of 2500+ parkings, made accessible to cyclists <a href=\"https://velopark.be/\">online</a>.";
  schema:image "/img/use-cases/velopark.png";
  schema:name "Velopark";
  schema:url "https://velopark.be/" .

Returns the correct results.
But when adding an @optional field.
Changing the query to:

{
      name @single
      image @single
      readMoreUrl @single
      rml @single
      rules @optional @single
}

Causes the resultset to shrink, the missing results may or may not have the rules field.
When adding another field to this query like so:

{
	  type (_:useCase)
	  name @single
	  image @single
	  readMoreUrl @single
	  rml @single
	  knowledgeGraph @optional @single
	  rules @optional @single
}

The resultset was suddenly back to what was to be expected.
I have had similar behavior on other queries and datasets.

Interesting note:
When using SPARQLAlgebra.js to convert the algebra object made by GraphQL-LD into sparql code and then back into an algebra object (producing a new but very different algebra object, I realise multiple algebra objects can represent the same query, but perhaps this could help towards debugging), the problem was solved.

Context for reference:

{
        "schema": "http://schema.org/",
        "ex": "http://example.com/rmlio/",
        "type": "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
        "softwareCategory": "ex:softwareCategory",
        "linkSet": "ex:linkSet",
        "slug": "ex:slug",
        "name": "schema:name",
        "description": "schema:description",
        "tools": "ex:content",
        "abstract": "schema:abstract",
        "links": "ex:linkSet",
        "url": "schema:url"
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions