<commit_before>prefix dc:    <http://purl.org/dc/elements/1.1/>
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
prefix geo:   <http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix conn:  <http://localhost:8080/won/resource/connection/>
prefix event: <http://localhost:8080/won/resource/event/>
prefix woncrypt: <https://w3id.org/won/core#>
prefix xsd:   <http://www.w3.org/2001/XMLSchema#>
prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfg:   <http://www.w3.org/2004/03/trix/rdfg-1/>
prefix local: <http://localhost:8080/won/resource/>
prefix won:   <https://w3id.org/won/core#>
prefix msg:   <https://w3id.org/won/message#>
prefix signature: <http://icp.it-risk.iwvi.uni-koblenz.de/ontologies/signature.owl#>
prefix ldp:   <http://www.w3.org/ns/ldp#>


  SELECT

	?requiredGraphNames
    (if(?requiredGraphNames = if (bound(?type) && (?type = msg:AtomHintMessage || ?type = msg:SocketHintMessage ), 1,2) , "OK", "FAIL") AS ?check)

  WHERE 
  {     
   {SELECT ?type
      WHERE
      { 
        optional {
          graph ?g{
            ?g rdfg:subGraphOf ?event.
                 ?event msg:messageType ?type.
               ?event a msg:FromExternal
          }
        }
      }
    }
  
    {
	  SELECT ( COUNT(DISTINCT(?g)) as ?requiredGraphNames )
	  WHERE
	  {
        {
          SELECT ?message 
          WHERE
          {
              GRAPH ?envelope 
              {
                  ?envelope rdfg:subGraphOf ?message .
              } 
              FILTER( REGEX( STR( ?envelope ), ".+#envelope$" ) )
          }
      	}
        
	  	GRAPH ?g
	    {
	      ?a ?b ?c .
	    } 
        # idea: select only envelope + signature (required) plus anything that's not a content graph (illegal)
        FILTER(
        	STR( ?g ) = CONCAT(STR(?message),"#envelope" ) 
        	|| STR( ?g ) = CONCAT(STR(?message),"#signature" )
            || ! STRSTARTS( STR( ?g ), CONCAT(STR(?message),"#content" ))
          )
	  }
	}
  }
  
  <commit_msg>Be more lenient about content graph names<commit_after>prefix dc:    <http://purl.org/dc/elements/1.1/>
prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#>
prefix geo:   <http://www.w3.org/2003/01/geo/wgs84_pos#>
prefix conn:  <http://localhost:8080/won/resource/connection/>
prefix event: <http://localhost:8080/won/resource/event/>
prefix woncrypt: <https://w3id.org/won/core#>
prefix xsd:   <http://www.w3.org/2001/XMLSchema#>
prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfg:   <http://www.w3.org/2004/03/trix/rdfg-1/>
prefix local: <http://localhost:8080/won/resource/>
prefix won:   <https://w3id.org/won/core#>
prefix msg:   <https://w3id.org/won/message#>
prefix signature: <http://icp.it-risk.iwvi.uni-koblenz.de/ontologies/signature.owl#>
prefix ldp:   <http://www.w3.org/ns/ldp#>


  SELECT

	?requiredGraphNames
    (if(?requiredAndIllegalGraphs = if (bound(?type) && (?type = msg:AtomHintMessage || ?type = msg:SocketHintMessage ), 1,2) , "OK", "FAIL") AS ?check)

  WHERE 
  {     
   {SELECT ?type
      WHERE
      { 
        optional {
          graph ?g{
            ?g rdfg:subGraphOf ?event.
                 ?event msg:messageType ?type.
               ?event a msg:FromExternal
          }
        }
      }
    }
  
    {
	  SELECT ( COUNT(DISTINCT(?g)) as ?requiredAndIllegalGraphs )
	  WHERE
	  {
        {
          SELECT ?message 
          WHERE
          {
              GRAPH ?envelope 
              {
                  ?envelope rdfg:subGraphOf ?message .
              } 
              FILTER( REGEX( STR( ?envelope ), ".+#envelope$" ) )
          }
      	}
        
	  	GRAPH ?g
	    {
	      ?a ?b ?c .
	    } 
        # idea: select only envelope + signature (required) plus anything that's not a content graph (illegal), then fail if not the required number
        FILTER(
        	STR( ?g ) = CONCAT(STR(?message),"#envelope" ) 
        	|| STR( ?g ) = CONCAT(STR(?message),"#signature" )
            || ! STRSTARTS( STR( ?g ), CONCAT(STR(?message),"#" ))
          )
	  }
	}
  }
  
  
{'fraction_non_alphanumeric': 0.16199454229719673, 'fraction_numerical': 0.02877697841726619, 'mean_word_length': 2.0, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 6, 'lorem ipsum': 0, 'www.': 12, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3231446', 'n_tokens_mistral': 1576, 'n_tokens_neox': 1419, 'n_words': 253}