formula (E5)

From MaRDI portal
EntitySchema:E5
language codelabeldescriptionaliasesedit
enformulaschema for formulamathematical formula | formulae | formulasedit
# Schema for formulas in the MaRDI portal (EntitySchema:E5)
PREFIX rdf:      <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs:     <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl:      <http://www.w3.org/2002/07/owl#>
PREFIX skos:     <http://www.w3.org/2004/02/skos/core#>
PREFIX schema:   <http://schema.org/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd:       <https://portal.mardi4nfdi.de/entity/>
PREFIX wdt:      <https://portal.mardi4nfdi.de/prop/direct/>
PREFIX p:        <https://portal.mardi4nfdi.de/prop/>
PREFIX ps:       <https://portal.mardi4nfdi.de/prop/statement/>
PREFIX pq:       <https://portal.mardi4nfdi.de/prop/qualifier/>

start = @<formula>

# A formula must be an instance of Q96183 (formula)
# AND belong to the MathModDB community (P1495 = Q6534265).
<formula> EXTRA wdt:P31 wdt:P1495
                          rdfs:label skos:altLabel skos:prefLabel
                          schema:name schema:description
                          schema:version schema:dateModified
                          owl:sameAs wikibase:statements wikibase:sitelinks wikibase:identifiers {
  # instance of: formula
  wdt:P31    [ wd:Q96183 ] ;
  # community: MathModDB
  wdt:P1495  [ wd:Q6534265 ] ;
  # assumes: zero, one or more formulas
  wdt:P1674 @<formula> * ;
  # statements below trigger qualifiers validation
  p:P1655  @<approximatedByStatement> * ;
  p:P1560  @<containsStatement> * ;
  p:P286   @<describedBySourceStatement> * ;
  p:P1656  @<discretizedByStatement> * ;
  p:P1657  @<linearizedByStatement> * ;
  p:P1658  @<nondimensionalizedByStatement> * ;
  p:P1684  @<specializedByStatement> * ;
} AND
(
  # Case A: at least one of each present.
  {
    p:P989  @<hasDefiningFormulaStatement> + ;
    p:P983  @<isInDefiningFormulaStatement> + ;
  }
  OR
  # Case B: neither present.
  {
    p:P989  @<hasDefiningFormulaStatement> {0} ;
    p:P983  @<isInDefiningFormulaStatement> {0} ;
  }
)

# Statement node for P1655.
# Uses <formulaRef> instead of <formula> to avoid
# circular negative dependencies caused by mutual EXTRA recursion.
<approximatedByStatement> EXTRA ps:P1655 {
  ps:P1655   @<formulaRef> ;         # statement value: another formula
}

# Statement node for P1560 — value must be a formula or quantity; role qualifier allowed
<containsStatement> (
  @<containsFormulaStatement>
  OR
  @<containsQuantityStatement>
)

# Branch 1 — value is a formula: qualifiers allowed
<containsFormulaStatement> EXTRA ps:P1560 {
  ps:P1560  @<formulaRef> ;
  pq:P560   [ wd:Q6775641 wd:Q6534259 wd:Q6775579 wd:Q6775587
              wd:Q6534262 wd:Q6534266 wd:Q6534267 wd:Q6534264
              wd:Q6775588 wd:Q6775640 wd:Q6775618 ] * ;
  # qualifier: series ordinal — 1-based integer position of this formula, optional
  pq:P146   LITERAL ?
}

# Branch 2 — value is a quantity: no qualifiers
<containsQuantityStatement> EXTRA ps:P1560 {
  ps:P1560  @<quantityRef> ;
}

<describedBySourceStatement> EXTRA ps:P286 pq:P560 {
  ps:P286    @<publication> ;
  # qualifier: object has role = review, use, invention, documentation, or science project, analysis, application (optional)
  pq:P560    [ wd:Q6672366 wd:Q6480405 wd:Q6672344 wd:Q6672349 wd:Q6775621 wd:Q6825292 wd:Q6825298 ] *
}

<publication> EXTRA wdt:P31
                    rdfs:label skos:altLabel schema:description
                    schema:version schema:dateModified owl:sameAs
                    wikibase:statements wikibase:sitelinks wikibase:identifiers {
  # instance of: scholarly article, conference paper, chapter, monograph, thesis, dissertation,
  # book, report, scientific journal, (version, edition, or translation), ISO standard edition, YouTube channel
  # written work, volume, reference work, encyclopedic dictionary, Jewish encyclopedia, universal encyclopedia
  # literary work, controlled vocabulary, explanatory dictionary
  wdt:P31    [ wd:Q56887 wd:Q56888 wd:Q56552 wd:Q56763  wd:Q57010 wd:Q56927
                     wd:Q56401 wd:Q57006 wd:Q56973 wd:Q56536 wd:Q7268923 wd:Q7270076
                     wd:Q56538 wd:Q56449 wd:Q7274954 wd:Q7284804  wd:Q7284810 wd:Q7284813
                     wd:Q56811 wd:Q7284835 wd:Q7284945] ;
}

<discretizedByStatement> EXTRA ps:P1656 {
  # statement value: another formula
  ps:P1656 @<formulaRef> ;
}

<linearizedByStatement> EXTRA ps:P1657 {
  # statement value: another formula
  ps:P1657 @<formulaRef> ;
}

<nondimensionalizedByStatement> EXTRA ps:P1658 {
  # statement value: another formula
  ps:P1658 @<formulaRef> ;
}

<specializedByStatement> EXTRA ps:P1684 {
  # statement value: another formula
  ps:P1684 @<formulaRef> ;
}

# Statement node for P989 ("defining formula").
# Value is a Math-datatype literal (LaTeX)
<hasDefiningFormulaStatement> EXTRA ps:P989 {
  ps:P989   LITERAL ;
}

# Statement node for P983 ("in defining formula").
# Value is a Math-datatype literal (LaTeX)
<isInDefiningFormulaStatement> EXTRA ps:P983 {
  ps:P983   LITERAL ;
}

# Lightweight reference shape for formulas — no recursion beyond
# instance-of + community.
<formulaRef> EXTRA wdt:P31 wdt:P1495 {
  # instance of: formula (or a formula subtype)
  wdt:P31    [ wd:Q96183 wd:Q6672081 wd:Q6822213 wd:Q6672083 ] + ;
  # community: MathModDB
  wdt:P1495  [ wd:Q6534265 ]
}

# Lightweight reference shape for quantities — no recursion beyond
# instance-of + community.
<quantityRef> EXTRA wdt:P31 wdt:P1495 {
  wdt:P31    [ wd:Q6534237 ] ;
  # community: MathModDB
  wdt:P1495  [ wd:Q6534265 ]
}